|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Object
Map
public class Map
This class implements a hashtable, which maps keys to values. Any non-null object can be used as a key or as a value.
| Constructor Summary | |
|---|---|
Map()
Constructs a new Map instance. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all mappings from this map. |
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the specified value. |
List |
keys()
Returns a list containing all the keys on this map. |
Object |
operator_get(Object key)
Operator to return the value to which this map maps the specified key. |
Object |
operator_set(Object key,
Object value)
Associates the specified value with the specified key in this map. |
Map |
put(Object key,
Object value)
Associates the specified value with the specified key in this map. |
Object |
remove(Object key)
Removes the mapping for this key from this map if it is present. |
int |
size()
Returns the number of key-value mappings in this map. |
List |
values()
Returns a list containing all the values on this map. |
| Methods inherited from class Object |
|---|
toString, equals, hashCode |
| Methods inherited from |
|---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Map()
| Method Detail |
|---|
public int size()
public void clear()
public Map put(Object key,
Object value)
key - key with which the specified value is to be associated.value - value to be associated with the specified key.
Map instance.public Object remove(Object key)
Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. The map will not contain a mapping for the specified key once the call returns.
key - key whose mapping is to be removed from the map.
public boolean containsKey(Object key)
key - key whose presence in this map is to be tested.
public boolean containsValue(Object value)
value - value whose presence in this map is to be tested.
public List keys()
public List values()
public Object operator_get(Object key)
Map map = ...;
String s = map["name"];
key - key whose associated value is to be returned.
public Object operator_set(Object key,
Object value)
Map map = ...;
map["city"] = "Rome";
key - key with which the specified value is to be associated.value - value to be associated with the specified key.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||