|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.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()
AbstractMapThis implementation returns entrySet().size().
size in interface Mapsize in class AbstractMappublic boolean isEmpty()
AbstractMapThis implementation returns size() == 0.
isEmpty in interface MapisEmpty in class AbstractMappublic boolean containsKey(Object key)
AbstractMapThis 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 MapcontainsKey in class AbstractMapkey - key whose presence in this map is to be tested.
public boolean containsValue(Object value)
AbstractMapThis 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 MapcontainsValue in class AbstractMapvalue - value whose presence in this map is to be tested.
public Object get(Object key)
AbstractMapThis 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 Mapget in class AbstractMapkey - key whose associated value is to be returned.
AbstractMap.containsKey(Object)public Set keySet()
AbstractMapThis 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 MapkeySet in class AbstractMappublic Set entrySet()
AbstractMap
entrySet in interface MapentrySet in class AbstractMappublic Collection values()
AbstractMapThis 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 Mapvalues in class AbstractMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||