|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.marringtons.number.IntegerMap
IntegerMap is a convenience class where the key and value is an integer rather than an object. The key can be either integer or object.
map.put(1, 1);
assertTrue(map.get(1).intValue() == 1);
map.put("two", 2);
assertTrue(map.get("two").intValue() == 2);
| Constructor Summary | |
IntegerMap()
Creates a local map for integer values (that may be overridden if needed). |
|
| Method Summary | |
Integer |
get(int key)
Retrieve an integer value for an integer key. |
Integer |
get(Object key)
Retrieve an integer value for an Object key (normally a string). |
void |
put(int key,
int value)
Associates the specified integer value with the specified integer key in this map. |
void |
put(Object key,
int value)
Associates the specified integer value with the specified key in this map. |
void |
setMap(Map map)
When the default HashMap is not the correct map for the job, call setMap(). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public IntegerMap()
| Method Detail |
public void setMap(Map map)
map - to use as integer map - allowing any form of map to be used.public Integer get(Object key)
key - to retrieve integer value for.
public Integer get(int key)
key - to retrieve integer value for.
public void put(int key,
int value)
key - integer key to which the specified integer value is associated.value - integer value to be associated with the provided integer key.
public void put(Object key,
int value)
key - key to which the specified integer value is associated.value - integer value to be associated with the provided key.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||