The Collections Helper Class

As we mentioned above, there is a “helper” class that contains about 50 static methods and nested classes that operate on or return a Collection. Here's the API for that class Collections, simplified to omit generic parameters.

We'll first show the class, then look at generic parameters in more detail.

public class Collections extends Object {    public static final Set EMPTY_SET;    public static final List EMPTY_LIST;    public static final Map EMPTY_MAP;    public static void sort(List);    public static void sort(List, Comparator);    public static int binarySearch(List, Object);    public static int iteratorBinarySearch(List, Object);    public static int binarySearch(List, Object, Comparator);    public static int  ...

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.