|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap java.util.Collections.SingletonMap
Nested Class Summary | |
private static class |
Collections.SingletonMap.ImmutableEntry
|
Nested classes inherited from class java.util.AbstractMap |
AbstractMap.SimpleEntry |
Nested classes inherited from class java.util.Map |
Map.Entry |
Field Summary | |
private Set |
entrySet
|
private Object |
k
|
private Set |
keySet
|
private Object |
v
|
private Collection |
values
|
Constructor Summary | |
(package private) |
Collections.SingletonMap(Object key,
Object value)
|
Method Summary | |
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 this value. |
Set |
entrySet()
Returns a set view of the mappings contained in this map. |
Object |
get(Object key)
Returns the value to which this map maps the specified key. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
Set |
keySet()
Returns a Set view of the keys contained in this map. |
int |
size()
Returns the number of key-value mappings in this map. |
Collection |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class java.util.AbstractMap |
clear, clone, equals, hashCode, put, putAll, remove, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private final Object k
private final Object v
private transient Set keySet
private transient Set entrySet
private transient Collection values
Constructor Detail |
Collections.SingletonMap(Object key, Object value)
Method Detail |
public int size()
AbstractMap
This implementation returns entrySet().size().
size
in interface Map
size
in class AbstractMap
public boolean isEmpty()
AbstractMap
This implementation returns size() == 0.
isEmpty
in interface Map
isEmpty
in class AbstractMap
public boolean containsKey(Object key)
AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, true is returned. If the iteration terminates without finding such an entry, false is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
containsKey
in interface Map
containsKey
in class AbstractMap
key
- key whose presence in this map is to be tested.
public boolean containsValue(Object value)
AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified value. If such an entry is found, true is returned. If the iteration terminates without finding such an entry, false is returned. Note that this implementation requires linear time in the size of the map.
containsValue
in interface Map
containsValue
in class AbstractMap
value
- value whose presence in this map is to be tested.
public Object get(Object key)
AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, the entry's value is returned. If the iteration terminates without finding such an entry, null is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
get
in interface Map
get
in class AbstractMap
key
- key whose associated value is to be returned.
AbstractMap.containsKey(Object)
public Set keySet()
AbstractMap
This implementation returns a Set that subclasses AbstractSet. The subclass's iterator method returns a "wrapper object" over this map's entrySet() iterator. The size method delegates to this map's size method and the contains method delegates to this map's containsKey method.
The Set is created the first time this method is called, and returned in response to all subsequent calls. No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same Set.
keySet
in interface Map
keySet
in class AbstractMap
public Set entrySet()
AbstractMap
entrySet
in interface Map
entrySet
in class AbstractMap
public Collection values()
AbstractMap
This implementation returns a collection that subclasses abstract collection. The subclass's iterator method returns a "wrapper object" over this map's entrySet() iterator. The size method delegates to this map's size method and the contains method delegates to this map's containsValue method.
The collection is created the first time this method is called, and returned in response to all subsequent calls. No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same Collection.
values
in interface Map
values
in class AbstractMap
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |