com.googlecode.biscotti.collect
Class Collections4

java.lang.Object
  extended by com.googlecode.biscotti.collect.Collections4

public final class Collections4
extends Object

Static utility methods which operate on or return Collections and Maps.

Copied from http://biscotti.googlecode.com/svn-history/r193/trunk/src/com/googlecode/biscotti/collect/Collections4.java, 26 jan 2011, because the lib is not published in maven yet. A few modifications for sticking to conventions of this project. Deleted some unneeded parts.


Constructor Summary
Collections4()
           
 
Method Summary
static
<K,V> NavigableMap<K,V>
unmodifiable(NavigableMap<K,? extends V> nm)
          Returns an unmodifiable view of the specified NavigableMap.
static
<E> NavigableSet<E>
unmodifiable(NavigableSet<E> ns)
          Returns an unmodifiable view of the specified NavigableSet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Collections4

public Collections4()
Method Detail

unmodifiable

public static <E> NavigableSet<E> unmodifiable(NavigableSet<E> ns)
Returns an unmodifiable view of the specified NavigableSet. This method allows modules to provide users with "read-only" access to internal navigable sets. Query operations on the returned set "read through" to the specified set. Attempts to modify the returned navigable set, whether direct, via its iterator, or via its subSet, headSet, or tailSet views, result in an UnsupportedOperationException.

The returned navigable set will be serializable if the specified set is serializable.

Type Parameters:
E - element type
Parameters:
ns - the navigable set for which an unmodifiable view is to be returned
Returns:
an unmodifiable view of the specified navigable set

unmodifiable

public static <K,V> NavigableMap<K,V> unmodifiable(NavigableMap<K,? extends V> nm)
Returns an unmodifiable view of the specified NavigableMap. This method allows modules to provide users with "read-only" access to internal navigable maps. Query operations on the returned map "read through" to the specified map. Attempts to modify the returned navigable map, whether direct, via its collection views, or via its subMap, headMap, or tailMap views, result in an UnsupportedOperationException .

The returned navigable map will be serializable if the specified map is serializable.

Type Parameters:
K - key type
V - value type
Parameters:
nm - the navigable map for which an unmodifiable view is to be returned
Returns:
an unmodifiable view of the specified navigable map


Copyright © 2011. All Rights Reserved.