org.alfresco.util
Class OneToManyHashBiMap

java.lang.Object
  extended by org.alfresco.util.OneToManyHashBiMap
All Implemented Interfaces:
java.util.Map, OneToManyBiMap, OneToManyMap

public class OneToManyHashBiMap
extends java.lang.Object
implements java.util.Map, OneToManyBiMap


Constructor Summary
OneToManyHashBiMap()
           
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsSingleValue(java.lang.Object value)
          This method returns true if any of the value sets in the OneToManyMap contains an equivalent object to the value parameter, where equivalence is determined using the equals(Object) method.
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entries()
          This method is similar to the java.util.Map.entrySet() method, however the entries returned map from a key to a value, rather than from a key(K) to a value(V) rather than froma key(K) to a set of values(Set<V>).
 java.util.Set entrySet()
           
 java.util.Collection flatValues()
          Returns a Collection of all the values in the map.
 java.util.Set get(java.lang.Object key)
           
 java.lang.Object getKey(java.lang.Object value)
          Returns the key, if any, for the specified value.
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.util.Set put(java.lang.Object key, java.util.Set values)
           
 void putAll(java.util.Map m)
           
 void putAllSingleValues(java.util.Map m)
          This method is similar to java.utilMap.putAll(Map m), however the map specified is from keys to values instead of keys to sets of values.
 java.lang.Object putSingleValue(java.lang.Object key, java.lang.Object value)
          This method is similar to the method java.util.Map.put(K, V) , however it allows the user to add a single value to the map rather than adding a java.util.Set containing one or more values.
 java.util.Set remove(java.lang.Object key)
           
 java.lang.Object removeValue(java.lang.Object value)
          Removes the specified value from the OneToManyBiMap.
 int size()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

OneToManyHashBiMap

public OneToManyHashBiMap()
Method Detail

clear

public void clear()
Specified by:
clear in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map

containsSingleValue

public boolean containsSingleValue(java.lang.Object value)
Description copied from interface: OneToManyMap
This method returns true if any of the value sets in the OneToManyMap contains an equivalent object to the value parameter, where equivalence is determined using the equals(Object) method.

Specified by:
containsSingleValue in interface OneToManyMap
Parameters:
value - The value being searched for.
Returns:
Returns true if any of the value sets contains a matching value, otherwise returns false

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

entries

public java.util.Set entries()
Description copied from interface: OneToManyMap
This method is similar to the java.util.Map.entrySet() method, however the entries returned map from a key to a value, rather than from a key(K) to a value(V) rather than froma key(K) to a set of values(Set<V>).
Note that the entries returned by this method do not support the method java.util.Map.Entry.setValue(V).

Specified by:
entries in interface OneToManyMap
Returns:
The Set<Entry<K, V>> representing all the key-value pairs in the ManyToOneMap.

get

public java.util.Set get(java.lang.Object key)
Specified by:
get in interface java.util.Map

getKey

public java.lang.Object getKey(java.lang.Object value)
Description copied from interface: OneToManyBiMap
Returns the key, if any, for the specified value. If the specified value does not exist within the map then this method returns null.

Specified by:
getKey in interface OneToManyBiMap
Returns:
The key to the specified value or null.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

put

public java.util.Set put(java.lang.Object key,
                         java.util.Set values)
Specified by:
put in interface java.util.Map

putSingleValue

public java.lang.Object putSingleValue(java.lang.Object key,
                                       java.lang.Object value)
Description copied from interface: OneToManyMap
This method is similar to the method java.util.Map.put(K, V) , however it allows the user to add a single value to the map rather than adding a java.util.Set containing one or more values. If the specified key already has a set of values associated with it then the new value is added to this set. Otherwise a new set is created and the new value is added to that.

Specified by:
putSingleValue in interface OneToManyMap
Returns:
returns the newly added value.

putAll

public void putAll(java.util.Map m)
Specified by:
putAll in interface java.util.Map

putAllSingleValues

public void putAllSingleValues(java.util.Map m)
Description copied from interface: OneToManyMap
This method is similar to java.utilMap.putAll(Map m), however the map specified is from keys to values instead of keys to sets of values.

Specified by:
putAllSingleValues in interface OneToManyMap
Parameters:
m - A map containing the key-value mappings to be added to the ManyToOneMap.

remove

public java.util.Set remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map

removeValue

public java.lang.Object removeValue(java.lang.Object value)
Description copied from interface: OneToManyBiMap
Removes the specified value from the OneToManyBiMap. If this was the only value associated with the key to this value, then the key is also removed.

Specified by:
removeValue in interface OneToManyBiMap
Parameters:
value - The value to be removed.
Returns:
The key that is associated with the value to be removed.

size

public int size()
Specified by:
size in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map

flatValues

public java.util.Collection flatValues()
Description copied from interface: OneToManyMap
Returns a Collection of all the values in the map. Unlike values() the values are in a single flattened Collection<V> rather than a Collection<Set<V>>.

Specified by:
flatValues in interface OneToManyMap
Returns:
All the values in the map as a flattened Collection.


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.