| Constructor and Description |
|---|
StringDictionary()
Instantiates a new instance of a
StringDictionary. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears this dictionary so that it contains no keys.
|
boolean |
containsKey(Object key)
Tests if the specified object is a key in this dictionary.
|
boolean |
containsKey(String key)
Tests if the specified object is a key in this dictionary.
|
boolean |
containsValue(Object value)
Returns true if this dictionary maps one or more keys to this value.
|
boolean |
containsValue(String value)
Returns true if this dictionary maps one or more keys to this value.
|
Set<Map.Entry<String,String>> |
entrySet()
Returns a
Set view of the mappings contained in this map. |
String |
get(Object key)
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
boolean |
isEmpty()
Tests if this dictionary maps no keys to values.
|
Set<String> |
keySet()
Returns a
Set view of the keys contained in this map. |
String |
put(String key,
String value)
Maps the specified
key to the specified value in this dictionary. |
void |
putAll(Map<? extends String,? extends String> t)
Copies all of the mappings from the specified map to this dictionary.
|
String |
remove(Object key)
Removes the key (and its corresponding value) from this
dictionary.
|
int |
size()
Returns the number of keys in this dictionary.
|
Collection<String> |
values()
Returns a
Collection view of the values contained in this map. |
public StringDictionary()
StringDictionary.public void clear()
public boolean containsKey(Object key)
containsKey in interface Map<String,String>key - possible keytrue if and only if the specified object
is a key in this dictionary, as determined by the
equals method; false otherwise.public boolean containsKey(String key)
key - possible keytrue if and only if the specified object
is a key in this dictionary, as determined by the
equals method; false otherwise.IllegalArgumentException - if the key is nullpublic boolean containsValue(Object value)
containsValue in interface Map<String,String>value - value whose presence in this dictionary is to be testedtrue if this map maps one or more keys to the
specified valueIllegalArgumentException - if the value is nullpublic boolean containsValue(String value)
value - value whose presence in this dictionary is to be testedIllegalArgumentException - if the value is nullpublic Set<Map.Entry<String,String>> entrySet()
Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation, or through the
setValue operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and
clear operations. It does not support the
add or addAll operations.public String get(Object key)
null if this map contains no mapping for the key.get in interface Map<String,String>key - the key whose associated value is to be returnednull if this map contains no mapping for the keyIllegalArgumentException - if the specified key is not an instance of String or nullpublic boolean isEmpty()
public Set<String> keySet()
Set view of the keys contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation), the results of
the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove,
removeAll, retainAll, and clear
operations. It does not support the add or addAll
operations.public String put(String key, String value)
key to the specified value in this dictionary.
Neither the key nor the value can be null.
The value can be retrieved by calling the get method
with a key that is equal to the original key.
put in interface Map<String,String>key - the dictionary keyvalue - the valuenull if it did not have oneIllegalArgumentException - if the key or value is nullpublic void putAll(Map<? extends String,? extends String> t)
putAll in interface Map<String,String>t - mappings to be stored in this mapIllegalArgumentException - if the specified map is nullpublic String remove(Object key)
remove in interface Map<String,String>key - the key that needs to be removednull if the key did not have a mappingIllegalArgumentException - if the key is not an instance of String or is nullpublic int size()
public Collection<String> values()
Collection view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. If the map is
modified while an iteration over the collection is in progress
(except through the iterator's own remove operation),
the results of the iteration are undefined. The collection
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Collection.remove, removeAll,
retainAll and clear operations. It does not
support the add or addAll operations.Copyright © 2014. All rights reserved.