|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.binding.util.MultipleValueMap
public class MultipleValueMap
Map supporting multiple values for a single key. The multiple value concept doesn't really fit with the standard collections idea of a map, so this provides its own variation of a map interface rather than extend the standard one.
Nested Class Summary | |
---|---|
class |
MultipleValueMap.MultipleIterator
Iterator for only the multiple-valued keys in the map. |
private static class |
MultipleValueMap.MultipleValueList
List used for multiple values. |
Field Summary | |
---|---|
private java.util.HashMap |
m_backingMap
Backing map from key to value or array of values. |
private java.lang.Object |
m_lastKey
Last lookup key ( null if none, or if value changed). |
private java.lang.Object |
m_lastValue
Last lookup value ( null if none, or if value changed). |
private int |
m_valueCount
Actual number of values (not keys) present in map. |
Constructor Summary | |
---|---|
MultipleValueMap()
Constructor. |
Method Summary | |
---|---|
void |
add(java.lang.Object key,
java.lang.Object value)
Add value for key. |
void |
clear()
Clear all entries. |
boolean |
containsKey(java.lang.Object key)
Check key present in map. |
java.util.ArrayList |
extract(java.lang.Object key)
Extract all values for key. |
java.util.ArrayList |
get(java.lang.Object key)
Get all values for key. |
java.lang.Object |
get(java.lang.Object key,
int index)
Get indexed value for key. |
int |
getCount(java.lang.Object key)
Get number of values present for key. |
private java.lang.Object |
getMapped(java.lang.Object key)
Internal cached lookup. |
boolean |
isEmpty()
Check if map is empty. |
java.util.Set |
keySet()
Get key set. |
int |
keySize()
Get number of keys. |
java.util.Iterator |
multipleIterator()
Get iterator over only the multiple-valued keys present in the map. |
int |
valueSize()
Get number of values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.util.HashMap m_backingMap
private int m_valueCount
private java.lang.Object m_lastKey
null
if none, or if value changed).
private java.lang.Object m_lastValue
null
if none, or if value changed).
Constructor Detail |
---|
public MultipleValueMap()
Method Detail |
---|
private java.lang.Object getMapped(java.lang.Object key)
key
-
public void clear()
public int getCount(java.lang.Object key)
key
-
public java.lang.Object get(java.lang.Object key, int index)
key
- index
-
public void add(java.lang.Object key, java.lang.Object value)
key
- value
- public java.util.ArrayList get(java.lang.Object key)
key
-
public java.util.ArrayList extract(java.lang.Object key)
key
-
public int keySize()
public int valueSize()
public java.util.Iterator multipleIterator()
public boolean containsKey(java.lang.Object key)
key
-
public boolean isEmpty()
public java.util.Set keySet()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |