Difference between Collection and Collections. — Cracked Java
// Java Collections Framework · Framework Overview & Hierarchy
JuniorTheoryTrick

Difference between Collection and Collections.

Collection is an interface; Collections is a utility class. The trailing s matters: Collection<E> (in java.util) is the root interface for groups of elements, while Collections (also in java.util) is a final class full of static helper methods that operate on Collection instances.

Collection — The Interface

Collection<E> defines the contract every list, set, and queue obeys: add, remove, contains, size, iterator, and friends. You implement it (rarely directly — you typically implement List or Set), and you program against it when you want to be implementation-agnostic.

public int countNonNull(Collection<?> items) {
    int n = 0;
    for (var x : items) if (x != null) n++;
    return n;
}
// Accepts List, Set, Queue, ArrayDeque — anything that's a Collection.

Collections — The Utility Class

Collections (note the s) is modeled after Arrays and Math — a final class with a private constructor and dozens of static methods:

  • Algorithms: sort, binarySearch, reverse, shuffle, min, max, frequency, disjoint.
  • Wrappers: unmodifiableList, synchronizedList, checkedList — return wrapper views.
  • Factories (mostly superseded by Java 9 List.of etc.): emptyList, singletonList, nCopies.
  • Bulk ops: addAll, fill, replaceAll, swap.
List<Integer> xs = new ArrayList<>(List.of(3, 1, 4, 1, 5, 9));
Collections.sort(xs);                              // mutates in place
int idx = Collections.binarySearch(xs, 4);         // requires sorted list
List<Integer> readonly = Collections.unmodifiableList(xs);
List<Integer> threadSafe = Collections.synchronizedList(xs);

Side-by-Side

AspectCollectionCollections
KindInterfaceFinal utility class
Packagejava.utiljava.util
InstantiableImplemented by ArrayList, HashSetNo — private constructor
MethodsInstance methods (add, size)Static methods (sort, reverse)
IntroducedJava 1.2Java 1.2
Typical useParameter/return typeCollections.method(coll)

Why the Confusion Persists

The naming is unfortunate — Bloch has admitted that on a do-over he might have called it CollectionUtils. But the convention is consistent with Arrays (utility for []) and Objects (utility for Object). Modern Guava and Apache Commons echo this pattern with Lists, Maps, Sets.

Mark your status