|
|||||||||
| Home >> All >> java >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.util
Class Collections.SingletonMap

java.lang.Objectjava.util.AbstractMap
java.util.Collections.SingletonMap
- All Implemented Interfaces:
- Map, java.io.Serializable
- Enclosing class:
- Collections
- private static final class Collections.SingletonMap
- extends AbstractMap
- implements java.io.Serializable
- extends AbstractMap
The implementation of Collections.singletonMap(Object, Object) 55 . This class
name is required for compatibility with Sun's JDK serializability.
| Nested Class Summary |
| Nested classes inherited from class java.util.AbstractMap |
AbstractMap.BasicMapEntry |
| Nested classes inherited from class java.util.Map |
Map.Entry |
| Field Summary | |
private Set |
entries
Cache the entry set. |
private java.lang.Object |
k
The single key. |
private static long |
serialVersionUID
Compatible with JDK 1.4. |
private java.lang.Object |
v
The corresponding value. |
| Fields inherited from class java.util.AbstractMap |
ENTRIES, keys, KEYS, values, VALUES |
| Constructor Summary | |
(package private) |
Collections.SingletonMap(java.lang.Object key,
java.lang.Object value)
Construct a singleton. |
| Method Summary | |
boolean |
containsKey(java.lang.Object key)
Single entry. |
boolean |
containsValue(java.lang.Object value)
Single entry. |
Set |
entrySet()
There is a single immutable entry. |
java.lang.Object |
get(java.lang.Object key)
Single entry. |
int |
hashCode()
Calculate the hashcode directly. |
Set |
keySet()
Return the keyset. |
int |
size()
The size: always 1! |
java.lang.String |
toString()
Obvious string. |
Collection |
values()
Return the values. |
| Methods inherited from class java.util.AbstractMap |
clear, clone, equals, equals, hashCode, isEmpty, put, putAll, remove |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- Compatible with JDK 1.4.
- See Also:
- Constant Field Values
k
private final java.lang.Object k
- The single key.
v
private final java.lang.Object v
- The corresponding value.
entries
private transient Set entries
- Cache the entry set.
| Constructor Detail |
Collections.SingletonMap
Collections.SingletonMap(java.lang.Object key, java.lang.Object value)
- Construct a singleton.
| Method Detail |
entrySet
public Set entrySet()
- There is a single immutable entry.
- Specified by:
entrySetin interfaceMap- Specified by:
entrySetin classAbstractMap
containsKey
public boolean containsKey(java.lang.Object key)
- Single entry.
- Specified by:
containsKeyin interfaceMap- Overrides:
containsKeyin classAbstractMap
containsValue
public boolean containsValue(java.lang.Object value)
- Single entry.
- Specified by:
containsValuein interfaceMap- Overrides:
containsValuein classAbstractMap
get
public java.lang.Object get(java.lang.Object key)
- Single entry.
- Specified by:
getin interfaceMap- Overrides:
getin classAbstractMap
hashCode
public int hashCode()
- Calculate the hashcode directly.
- Specified by:
hashCodein interfaceMap- Overrides:
hashCodein classAbstractMap
keySet
public Set keySet()
- Return the keyset.
- Specified by:
keySetin interfaceMap- Overrides:
keySetin classAbstractMap
size
public int size()
- The size: always 1!
- Specified by:
sizein interfaceMap- Overrides:
sizein classAbstractMap
values
public Collection values()
- Return the values. Technically, a singleton, while more specific than
a general Collection, will work. Besides, that's what the JDK uses!
- Specified by:
valuesin interfaceMap- Overrides:
valuesin classAbstractMap
toString
public java.lang.String toString()
- Obvious string.
- Overrides:
toStringin classAbstractMap
|
|||||||||
| Home >> All >> java >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC