|
||||||||||
| 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 |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
LinearMap()
Creates a LinearMap. |
|
LinearMap(int capacity)
Creates a LinearMap with specified capacity. |
|
LinearMap(Map map)
|
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set |
entrySet()
must return the same collection everytime as defined in the Map interface |
int |
find(Object key)
find the index of a key |
int |
findValue(V value)
find the index of a key |
V |
get(Object key)
|
K |
getKeyAt(int idx)
|
V |
getValueAt(int idx)
|
boolean |
isEmpty()
|
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(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(Object key)
|
V |
removeAt(int lIdx)
|
int |
size()
|
String |
toString()
|
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(Map map)
| Method Detail |
|---|
public Set entrySet()
entrySet in interface Map<K,V>
public V put(K key,
V value)
put in interface 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(Object key)
remove in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>public int find(Object key)
public int findValue(V value)
public void clear()
clear in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public K getKeyAt(int idx)
idx -
public V getValueAt(int idx)
idx -
public V get(Object key)
get in interface Map<K,V>key - public boolean isEmpty()
isEmpty in interface Map<K,V>public void putAll(Map<? extends K,? extends V> t)
putAll in interface Map<K,V>public int size()
size in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||