|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.LinearMap<K,V>
public class LinearMap<K,V>
LinearMap is a simplistic light-weight
Map designed for use when the number of entries is small. It is backed by a ArrayList.
TreeMap is not a 100% replacement, since TreeMap does not allow for NULL as a key.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
LinearMap()
Creates a LinearMap. |
|
LinearMap(int capacity)
Creates a LinearMap with specified capacity. |
|
LinearMap(java.util.Map map)
|
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
must return the same collection everytime as defined in the Map interface |
int |
find(java.lang.Object key)
find the index of a key |
int |
findValue(V value)
find the index of a key |
V |
get(java.lang.Object key)
|
K |
getKeyAt(int idx)
|
V |
getValueAt(int idx)
|
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
Return a set with all keys must return the same collection everytime as defined in the Map interface |
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> t)
|
V |
putAt(int idx,
K key,
V value)
Put key in certain place in index |
V |
putBefore(K refKey,
K key,
V value)
Append to end |
V |
remove(java.lang.Object key)
|
V |
removeAt(int lIdx)
|
int |
size()
|
java.lang.String |
toString()
|
java.util.Collection<V> |
values()
must return the same collection everytime as defined in the Map interface |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public LinearMap()
LinearMap.
public LinearMap(int capacity)
LinearMap with specified capacity.
public LinearMap(java.util.Map map)
| Method Detail |
|---|
public java.util.Set entrySet()
entrySet in interface java.util.Map<K,V>
public V put(K key,
V value)
put in interface java.util.Map<K,V>
public V putBefore(K refKey,
K key,
V value)
refKey - key - value - Throws IllegalArgumentException when the refKey does not exist
public V putAt(int idx,
K key,
V value)
idx - key - value -
public V removeAt(int lIdx)
public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>public int find(java.lang.Object key)
public int findValue(V value)
public void clear()
clear in interface java.util.Map<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>public K getKeyAt(int idx)
idx -
public V getValueAt(int idx)
idx -
public V get(java.lang.Object key)
get in interface java.util.Map<K,V>key - public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>public void putAll(java.util.Map<? extends K,? extends V> t)
putAll in interface java.util.Map<K,V>public int size()
size in interface java.util.Map<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||