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?
Java’s Collections.checked*() api gives us type-safe views to underlying collections. But the checks happen
Share
The javadoc explains it well:
http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#checkedCollection%28java.util.Collection,%20java.lang.Class%29