TUM CCSM Commons

edu.tum.cs.commons.collections
Class UnmodifiableHashedListMap<K,I>

java.lang.Object
  extended by edu.tum.cs.commons.collections.HashedListMap<K,I>
      extended by edu.tum.cs.commons.collections.UnmodifiableHashedListMap<K,I>

public class UnmodifiableHashedListMap<K,I>
extends HashedListMap<K,I>

This is a wrapper for a HashedListMap prohibiting all calls that would modify its contents. As the construction of this class is performed in constant time it is prefered over copying the collection (which takes linear time). All prohibited methods throw an UnsupportedOperationException.

Version:
$Revision: 26283 $
Author:
Florian Deissenboeck, $Author: juergens $
Rating:
GREEN Hash: DF82643A09598C2B595F267F0B8E66AA

Constructor Summary
UnmodifiableHashedListMap(HashedListMap<K,I> map)
          Create new unmodifiable hashed list map.
 
Method Summary
 void add(K key, I item)
          Operation is not supported.
 boolean containsList(K key)
          Check if a list is present for a given key.
 java.util.List<I> createList(K key)
          Operation is not supported.
 UnmodifiableSet<K> getKeys()
          Get keys.
 UnmodifiableList<I> getList(K key)
          Get list for key.
 UnmodifiableList<I> getValues()
          Return all values from all lists.
 
Methods inherited from class edu.tum.cs.commons.collections.HashedListMap
addAll, addAll, areAllListsEmpty, clear, listsToArrays, removeAllLists, removeList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnmodifiableHashedListMap

public UnmodifiableHashedListMap(HashedListMap<K,I> map)
Create new unmodifiable hashed list map.

Parameters:
map - the map to wrap
Throws:
java.lang.IllegalArgumentException - if map is null
Method Detail

createList

public java.util.List<I> createList(K key)
Operation is not supported.

Overrides:
createList in class HashedListMap<K,I>
Throws:
java.lang.UnsupportedOperationException

getList

public UnmodifiableList<I> getList(K key)
Get list for key.

Overrides:
getList in class HashedListMap<K,I>
Returns:
the list or null

add

public void add(K key,
                I item)
Operation is not supported.

Overrides:
add in class HashedListMap<K,I>
Throws:
java.lang.UnsupportedOperationException

containsList

public boolean containsList(K key)
Check if a list is present for a given key.

Overrides:
containsList in class HashedListMap<K,I>

getKeys

public UnmodifiableSet<K> getKeys()
Get keys.

Overrides:
getKeys in class HashedListMap<K,I>

getValues

public UnmodifiableList<I> getValues()
Return all values from all lists.

Overrides:
getValues in class HashedListMap<K,I>

TUM CCSM Commons

TUM CCSM Commons - 2.7