Class Collections
java.lang.Object
net.okapia.osid.torrefacto.collect.Collections
Static factory methods for
MultiMap, mirroring the wrappers
Collections provides for the standard collections.
It supplies synchronized and unmodifiable views of a multimap.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedjava.util.Collections has a private constructor so it can't be extended. -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> MultiMap <K, V> synchronizedMultiMap(MultiMap<K, V> m) Returns a synchronized (thread-safe) map backed by the specified map.static <K,V> MultiMap <K, V> unmodifiableMultiMap(MultiMap<K, V> m) Returns an unmodifiable view of the specified map.
-
Constructor Details
-
Collections
protected Collections()java.util.Collections has a private constructor so it can't be extended. This one is protected only so the class cannot be instantiated directly; it holds no state.
-
-
Method Details
-
synchronizedMultiMap
Returns a synchronized (thread-safe) map backed by the specified map. In order to guarantee serial access, it is critical that all access to the backing map is accomplished through the returned map.- Type Parameters:
K- the key typeV- the value type- Parameters:
m- the map to be "wrapped" in a synchronized map- Returns:
- a synchronized view of the specified map
-
unmodifiableMultiMap
Returns an unmodifiable view of the specified map. This method allows modules to provide users with "read-only" access to internal maps. Query operations on the returned map "read through" to the specified map, and attempts to modify the returned map, whether direct or via its collection views, result in an UnsupportedOperationException.- Type Parameters:
K- the key typeV- the value type- Parameters:
m- the map for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified map
-