Alex Rivera | Logout

Java Collections.checked*() vs Generic collections

Asked 2011-08-10T13:23:17.197
9

Java's Collections.checked*() api gives us type-safe views to underlying collections. But the checks happen at runtime and throw a runtime exception which can be costly for performance. The same type checking can be enforced at compile time by giving a specific type to those collections by using generic collections. So are there situations where Collections.checked*() scores over generic collections with their types specified?

Edit
Report

1 Answer

3

When using an old library with unchecked types in a new 1.5+ project.

answered 2011-08-10T13:25:45.960

Your Answer