Constructor and Description |
---|
StringToIntMap()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Check if the the argument string is defined as a key in this map.
|
int |
get(String key)
Get the value for the key.
|
int |
put(String key,
int value)
Add a key-value pair to the map.
|
public StringToIntMap()
Object.Object()
public boolean containsKey(String key)
key
- The string to be looked up.true
if a value is defined for this string; false
else.Map.containsKey(java.lang.Object)
public int get(String key)
key
- The string to be looked up.key
, or 0
if key
is not
a key in the map. Use containsKey()
to find out if
key
is actually defined in the map.public int put(String key, int value)
key
- The string key.value
- The int value.key
, if it was set. 0
else.Copyright © 2019. All rights reserved.