@XStreamConverter(value=ValuesTableConverter.class) public class ValuesTable<K,V> extends java.lang.Object implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<K> |
keys
Keys list.
|
protected java.util.Map<V,K> |
keysByValues
Keys by values map.
|
protected java.util.List<V> |
values
Values list.
|
protected java.util.Map<K,V> |
valuesByKeys
Values by keys map.
|
| Constructor and Description |
|---|
ValuesTable()
Constructs an empty ValuesTable with initial capacity of ten.
|
ValuesTable(int initialCapacity)
Constructs an empty ValuesTable with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
K key,
V value)
Adds a single entry (key-value pair) into this ValuesTable at the specified index.
|
void |
add(K key,
V value)
Adds a single entry (key-value pair) into this ValuesTable.
|
void |
addAll(java.util.Map<K,V> data)
Adds all Map entries into this ValuesTable.
|
void |
addAll(ValuesTable<K,V> data)
Adds all ValuesTable entries into this ValuesTable.
|
boolean |
contains(K key)
Returns whether this ValuesTable contains entry with specified key or not.
|
boolean |
containsKey(K key)
Returns whether this ValuesTable contains entry with specified key or not.
|
boolean |
containsValue(V value)
Returns whether this ValuesTable contains entry with specified value or not.
|
V |
get(int index)
Returns entry value at the specified index.
|
V |
get(K key)
Returns value from entry with specified key.
|
K |
getKey(int index)
Returns entry key at the specified index.
|
K |
getKey(V value)
Returns key from entry with specified value.
|
java.util.List<K> |
getKeys()
Returns copy of keys list.
|
V |
getValue(int index)
Returns entry value at the specified index.
|
V |
getValue(K key)
Returns value from entry with specified key.
|
java.util.List<V> |
getValues()
Returns copy of values list.
|
int |
indexOf(K key)
Returns index of entry with the specified key.
|
int |
indexOfKey(K key)
Returns index of entry with the specified key.
|
int |
indexOfValue(V value)
Returns index of entry with the specified value.
|
protected java.lang.String |
outOfBoundsMsg(int index)
Returns a message text for IndexOutOfBoundsException exception.
|
void |
put(int index,
K key,
V value)
Adds a single entry (key-value pair) into this ValuesTable at the specified index.
|
void |
put(K key,
V value)
Adds a single entry (key-value pair) into this ValuesTable.
|
void |
putAll(java.util.Map<K,V> data)
Adds all Map entries into this ValuesTable.
|
void |
putAll(ValuesTable<K,V> data)
Adds all ValuesTable entries into this ValuesTable.
|
void |
remove(int index)
Removes entry at the specified index.
|
void |
remove(K key)
Removes entry with the specified key.
|
void |
removeByKey(K key)
Removes entry with the specified key.
|
void |
removeByValue(V value)
Removes entry with the specified value.
|
protected void |
removeExistingEntry(int index)
Removes entry at the specified index.
|
int |
size()
Returns ValuesTable size.
|
protected java.util.List<K> keys
protected java.util.List<V> values
public ValuesTable()
public ValuesTable(int initialCapacity)
initialCapacity - initial table capacitypublic java.util.List<K> getKeys()
public java.util.List<V> getValues()
public void addAll(java.util.Map<K,V> data)
data - Map with entriespublic void putAll(java.util.Map<K,V> data)
data - Map with entriespublic void addAll(ValuesTable<K,V> data)
data - ValuesTable with entriespublic void putAll(ValuesTable<K,V> data)
data - ValuesTable with entriespublic void add(K key, V value)
key - entry keyvalue - entry valuepublic void put(K key, V value)
key - entry keyvalue - entry valuepublic void add(int index,
K key,
V value)
index - entry indexkey - entry keyvalue - entry valuepublic void put(int index,
K key,
V value)
index - entry indexkey - entry keyvalue - entry valuepublic void remove(K key)
key - entry keypublic void removeByKey(K key)
key - entry keypublic void removeByValue(V value)
value - entry valuepublic void remove(int index)
index - entry indexprotected void removeExistingEntry(int index)
index - entry indexpublic V get(int index)
index - entry indexpublic V getValue(int index)
index - entry indexpublic K getKey(int index)
index - entry indexpublic V get(K key)
key - entry keypublic V getValue(K key)
key - entry keypublic K getKey(V value)
value - entry valuepublic boolean contains(K key)
key - entry keypublic boolean containsKey(K key)
key - entry keypublic boolean containsValue(V value)
value - entry valuepublic int indexOf(K key)
key - entry keypublic int indexOfKey(K key)
key - entry keypublic int indexOfValue(V value)
value - entry valuepublic int size()
protected java.lang.String outOfBoundsMsg(int index)
index - index that is out of bounds