Compiere 3.1

org.compiere.util
Class MultiMap<K,V>

java.lang.Object
  extended by org.compiere.util.MultiMap<K,V>
Type Parameters:
K - Key
V - Value
All Implemented Interfaces:
Serializable, Map<K,V>

public final class MultiMap<K,V>
extends Object
implements Map<K,V>, Serializable

MultiMap allows multiple keys with their values. It accepts null values as keys and values. (implemented as two array lists)

Version:
$Id: MultiMap.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MultiMap()
          Constructor with 10 initial Capacity (same as ArrayList)
MultiMap(int initialCapacity)
          Constructor
 
Method Summary
 void clear()
          Clear content
 boolean containsKey(Object key)
          Contains Key
 boolean containsValue(Object value)
          Contains Value
 Set<Map.Entry<K,V>> entrySet()
          Get entry set - not implemented
 boolean equals(Object o)
          Equals - not implemented
 V get(Object key)
          Return ArrayList of Values of Key
 ArrayList<K> getKeys(Object value)
          Return ArrayList of Keys with Value
 ArrayList<V> getValues(Object key)
          Return ArrayList of Values of Key
 boolean isEmpty()
          Is Empty
 Set<K> keySet()
          Return HashSet of Keys
 void printToLog()
          dump all keys - values to log
 V put(K key, V value)
          Put Key & Value
 void putAll(Map<? extends K,? extends V> t)
          Put all
 V remove(Object key)
          Remove key
 int size()
          Return number of elements
 String toString()
          Returns class name and number of entries
 Collection<V> values()
          Return Collection of values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
hashCode
 

Constructor Detail

MultiMap

public MultiMap()
Constructor with 10 initial Capacity (same as ArrayList)


MultiMap

public MultiMap(int initialCapacity)
Constructor

Parameters:
initialCapacity - initial capacity
Method Detail

size

public int size()
Return number of elements

Specified by:
size in interface Map<K,V>
Returns:
size

isEmpty

public boolean isEmpty()
Is Empty

Specified by:
isEmpty in interface Map<K,V>
Returns:
true if empty

containsKey

public boolean containsKey(Object key)
Contains Key

Specified by:
containsKey in interface Map<K,V>
Parameters:
key - test key
Returns:
true if key exist

containsValue

public boolean containsValue(Object value)
Contains Value

Specified by:
containsValue in interface Map<K,V>
Parameters:
value - test value
Returns:
true if value exists

get

public V get(Object key)
Return ArrayList of Values of Key

Specified by:
get in interface Map<K,V>
Parameters:
key - key
Returns:
value

getValues

public ArrayList<V> getValues(Object key)
Return ArrayList of Values of Key

Parameters:
key - key
Returns:
array list of values

getKeys

public ArrayList<K> getKeys(Object value)
Return ArrayList of Keys with Value

Parameters:
value - value
Returns:
array list of keys

put

public V put(K key,
             V value)
Put Key & Value

Specified by:
put in interface Map<K,V>
Parameters:
key -
value -
Returns:
always null

remove

public V remove(Object key)
Remove key

Specified by:
remove in interface Map<K,V>
Parameters:
key - key
Returns:
removed value

putAll

public void putAll(Map<? extends K,? extends V> t)
Put all

Specified by:
putAll in interface Map<K,V>
Parameters:
t -

clear

public void clear()
Clear content

Specified by:
clear in interface Map<K,V>

keySet

public Set<K> keySet()
Return HashSet of Keys

Specified by:
keySet in interface Map<K,V>
Returns:
key set

values

public Collection<V> values()
Return Collection of values

Specified by:
values in interface Map<K,V>
Returns:
values

entrySet

public Set<Map.Entry<K,V>> entrySet()
Get entry set - not implemented

Specified by:
entrySet in interface Map<K,V>
Returns:
entry set

equals

public boolean equals(Object o)
Equals - not implemented

Specified by:
equals in interface Map<K,V>
Overrides:
equals in class Object
Parameters:
o - test object
Returns:
true if equal

toString

public String toString()
Returns class name and number of entries

Overrides:
toString in class Object
Returns:
info

printToLog

public void printToLog()
dump all keys - values to log


Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.