|
APCS Java Subset | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectap.java.util.TreeMap
Constructor Summary | |
TreeMap()
|
Method Summary | |
boolean |
containsKey(java.lang.Object key)
Returns true if there is a value associated
with key in this map, otherwise returns
false . |
java.lang.Object |
get(java.lang.Object key)
Return the value associated with key in this
map, or null if there is no value associated
wit key . |
Set |
keySet()
Returns a Set of the keys in the maps. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates value with key in
this map so that get(key) returns
value . |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from the map and returns the value previously associated with the key in the map. |
int |
size()
Return the number of keys in this map, which is the same as the number of (key,value) pairs. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TreeMap()
Method Detail |
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
Map
value
with key
in
this map so that get(key)
returns
value
. If key
was mapped to
a different value, the previous mapping is replaced.
put
in interface Map
key
- is what is mapped to/associated with
value
value
- is what key
is mapped to
key
or null
if there was no previous mapping.public java.lang.Object get(java.lang.Object key)
Map
key
in this
map, or null
if there is no value associated
wit key
.
get
in interface Map
key
- is the key whose associated value is returned
key
or null
if there is no such value.public boolean containsKey(java.lang.Object key)
Map
true
if there is a value associated
with key
in this map, otherwise returns
false
.
containsKey
in interface Map
key
- is the key for which the map is queried as to
the existence of an associated value
true
if there is a (key,value) pair in the map for
the specified key, otherwise return false
public int size()
Map
size
in interface Map
public Set keySet()
Map
Set
of the keys in the maps.
Removing a key from the associated set, e.g., via an iterator,
removes it from the map as well. The terminology for this
is that the set is backed by the map
keySet
in interface Map
public java.lang.Object remove(java.lang.Object key)
Map
null
is
returned.
remove
in interface Map
key
- is the key whose mapping is to be removed
key
or null
if there was no previous mapping.
|
unofficial documentation for the APCS Java Subset | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |