I’m wondering why class Collections was created. Theoritically methods from this class could be put in class AbstractCollection. So what was the reason seperate utils class was created?
I’m wondering why class Collections was created. Theoritically methods from this class could be
Share
AbstractCollection, and those methods are still applicable there.Collectionfrom an untrusted caller, being sure that you’re always using the same implementation of e.g.unmodifiableCollectioncan be helpful.Set<E> set = new HashSet<>();In this case, you won’t be able to use any methods defined inAbstractCollectionthat aren’t inCollection.