Collections class in Java consists only from static methods, as stated in the specs
This class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, "wrappers", which return a new collection backed by a specified collection, and a few other odds and ends.
The class has private constructor, however it is not marked as final
. Aren't there any performance benefits if the class would be final itself? What's the reason behind this?
final
for performance reasons. It's used to indicate the class is not meant to be extended. This class is obviously not meant to be extended, but who knows why it wasn't declaredfinal
? Maybe ask Josh Bloch? :)