|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.FixedsizeHashMap
This class implements fixed size HashMap. If its get full, no new entry can be inserted into it, except by removing some entry first. An attempt to add new entry throws an NoMoreStorageException
NoMoreStorageException
Constructor Summary | |
FixedsizeHashMap(int size)
Create a new hashMap that stores only the specified number of entries |
Method Summary | |
java.util.Set |
entrySet()
Returns the Set that contains all the entries in the Map |
java.lang.Object |
get(java.lang.Object key)
Returns the value mapped to the given key |
boolean |
isFull()
checks if the hash Map is full or not (ie if for adding new item we need to remove some item This method is not synchronized (it doesnt matter much if the count is 1 off or so) |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Maps the given key to the given value. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping specified by given key from the underlying datastructure |
java.lang.String |
toString()
Returns the string representation of the mappings |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FixedsizeHashMap(int size)
size
- the number of entries to hold
java.lang.IllegalArgumentException
- if size is less < 1.Method Detail |
public java.lang.Object put(java.lang.Object key, java.lang.Object value) throws NoMoreStorageException
NoMoreStorageException
- when no more space left in the storage
ideally, before calling put method, it should be checked whether the map is
already full or notisfull()
public java.lang.Object get(java.lang.Object key)
key
- The given key
public java.lang.Object remove(java.lang.Object key)
key
- The key to be removed
public java.util.Set entrySet()
public boolean isFull()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |