Mega Code Archive

 
Categories / Java Book / 005 Collection
 

0346 Return an unmodifiable view of collections

static<T> Collection<T> unmodifiableCollection(Collection<? extends T> c) Returns an unmodifiable view of the specified collection. static<T> List<T> unmodifiableList(List<? extends T> list) Returns an unmodifiable view of the specified list. static<K,V> Map<K,V> unmodifiableMap(Map<? extends K,? extends V> m) Returns an unmodifiable view of the specified map. static<T> Set<T> unmodifiableSet(Set<? extends T> s) Returns an unmodifiable view of the specified set. static<K,V> SortedMap<K,V> unmodifiableSortedMap(SortedMap<K,? extends V> m) Returns an unmodifiable view of the specified sorted map. static<T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s) Returns an unmodifiable view of the specified sorted set. Revised from Open JDK source code