|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.util.SimpleMapImpl
class 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 |
private static class |
SimpleMapImpl.NullKey
Special marker class used to represent null in the keys array. |
| 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 ConcurrentHashMap |
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 ConcurrentHashMap theKeysHere
| Constructor Detail |
|---|
public SimpleMapImpl()
| Method Detail |
|---|
public int size()
size in interface Map<Object,Object>public boolean isEmpty()
isEmpty in interface Map<Object,Object>public Collection values()
values in interface Map<Object,Object>public Set keySet()
keySet in interface Map<Object,Object>public void clear()
clear in interface Map<Object,Object>public boolean containsKey(Object key)
containsKey in interface Map<Object,Object>public boolean containsValue(Object value)
containsValue in interface Map<Object,Object>public Object get(Object key)
get in interface Map<Object,Object>
public Object put(Object key,
Object value)
put in interface Map<Object,Object>public Object remove(Object key)
remove in interface Map<Object,Object>public void putAll(Map t)
putAll in interface Map<Object,Object>private int getPostionByKey(Object key)
protected int getSubsumeKey(Object key)
private int getPostionByValue(Object value)
private void increaseCapacity()
public Set entrySet()
entrySet in interface Map<Object,Object>public boolean equals(Object o)
equals in interface Map<Object,Object>equals in class Objectpublic int hashCode()
hashCode in interface Map<Object,Object>hashCode in class Objectpublic Object clone()
clone in class Objectpublic String toString()
toString in class Object
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 | |||||||||