The Collections class contains the static methods for lists and collections. It also contains the methods for creating singleton sets, lists, and maps, and for creating unmodifiable sets, lists, and maps, as shown in Figure 22.25.
The Collections class defines three constants: one for an empty set, one for an empty list, and one for an empty map ( EMPTY_SET , EMPTY_LIST , and EMPTY_MAP ). The class also provides the singleton(Object o) method for creating an immutable set containing only a single item, the singletonList(Object o) method for creating an immutable list containing only a single item, and the singletonMap(Object key, Object value) method for creating an immutable map containing only a single mapping.
The Collections class also provides six static methods for creating read-only collections: unmodifiableCollection(Collection c) , unmodifiableList(List list) , unmodifiableMap(Map m) , unmodifiableSet(Set set) , unmodifiableSortedMap(SortedMap m ), and unmodifiableSortedSet(SortedSet s) . The read-only collections prevent the data in the collections from being modified, and, as well, offer better performance for read-only operations.