The Java Collections.checked * () api gives us types of safe views for basic collections. But checks are performed at runtime and raise an exception at runtime, which can be costly for performance. Validation of the same type can be applied at compile time by providing a specific type to these collections using shared collections. So, are there situations where Collections.checked * () evaluates common collections with the specified types?
Javadoc explains this well:
http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#checkedCollection%28java.util.Collection,%20java.lang.Class%29
generics (), . , . , . , , , , , .
, , , .
, , , - -. , generics , , - , : , .
Collections.checked*() , , ( , ).
Collections.checked*()
Collectons.checkedXxxxx() , . , , .
I doubt the performance difference is enough to worry. It will probably be around 10 ns or less.
When using the old library with unverified types in the new project 1.5+.