June 2017
Beginner
1296 pages
69h 23m
English
The Collections class provides a set of static methods that create unmodifiable wrappers for collections. Unmodifiable wrappers throw UnsupportedOperationExceptions if attempts are made to modify the collection. In an unmodifiable collection, the references stored in the collection are not modifiable, but the objects they refer are modifiable unless they belong to an immutable class like String. Headers for some of these methods are listed in Fig. 16.19. Details about these methods are available at http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html. All these methods take a generic type and return an unmodifiable view of the generic type. For example, the following code creates an unmodifiable ...
Read now
Unlock full access