|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectgate.util.SimpleMapImpl
Implements Map interface in using less memory. Very simple but usefull for small number of items on it.
| Nested Class Summary | |
private static class |
SimpleMapImpl.Entry
Auxiliary classes needed for the support of entrySet() method |
| Field Summary | |
(package private) int |
capacity
The capacity of the map |
(package private) int |
count
The current number of elements of the map |
(package private) static Object |
nullKey
the Object instance that will represent the NULL keys in the map |
(package private) static long |
serialVersionUID
Freeze the serialization UID. |
(package private) Object[] |
theKeys
Array keeping the keys of the entries in the map. |
static HashMap |
theKeysHere
the static 'all keys' collection |
(package private) Object[] |
theValues
Array keeping the values of the entries in the map. |
| Constructor Summary | |
SimpleMapImpl()
Constructor |
|
| Method Summary | |
void |
clear()
clear the map |
Object |
clone()
Create a copy of the map including the data. |
boolean |
containsKey(Object key)
return true if the key is in the map |
boolean |
containsValue(Object value)
return true if the map contains that value |
Set |
entrySet()
|
boolean |
equals(Object o)
|
Object |
get(Object key)
return the value associated with the key. |
private int |
getPostionByKey(Object key)
return positive value as index of the key in the map. |
private int |
getPostionByValue(Object value)
return positive value as index of the value in the map. |
protected int |
getSubsumeKey(Object key)
return the index of the key in the map comparing them by reference only. |
int |
hashCode()
return the hashCode for the map |
private void |
increaseCapacity()
|
boolean |
isEmpty()
return true if there are no elements in the map |
Set |
keySet()
return the set of the keys in the map. |
Object |
put(Object key,
Object value)
put a value in the map using the given key. |
void |
putAll(Map t)
put all the elements from a map |
private void |
readObject(ObjectInputStream s)
readObject - calls the default readObject() and then initialises the transient data |
Object |
remove(Object key)
remove value from the map using it's key. |
int |
size()
return the number of elements in the map |
String |
toString()
|
Collection |
values()
Not supported. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
int capacity
int count
Object[] theKeys
Object[] theValues
static final long serialVersionUID
static transient Object nullKey
public static transient HashMap theKeysHere
| Constructor Detail |
public SimpleMapImpl()
| Method Detail |
public int size()
size in interface Mappublic boolean isEmpty()
isEmpty in interface Mappublic Collection values()
values in interface Mappublic Set keySet()
keySet in interface Mappublic void clear()
clear in interface Mappublic boolean containsKey(Object key)
containsKey in interface Mappublic boolean containsValue(Object value)
containsValue in interface Mappublic Object get(Object key)
get in interface Map
public Object put(Object key,
Object value)
put in interface Mappublic Object remove(Object key)
remove in interface Mappublic void putAll(Map t)
putAll in interface Mapprivate int getPostionByKey(Object key)
protected int getSubsumeKey(Object key)
private int getPostionByValue(Object value)
private void increaseCapacity()
public Set entrySet()
entrySet in interface Mappublic boolean equals(Object o)
equals in interface Mappublic int hashCode()
hashCode in interface Mappublic Object clone()
public String toString()
private void readObject(ObjectInputStream s)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||