|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
com.tangosol.util.LiteMap
public class LiteMap
An implementation of java.util.Map that is optimal (in terms of both size and speed) for very small sets of data but still works excellently with large sets of data. This implementation is not thread-safe.
The LiteMap implementation switches at runtime between several different sub-implementations for storing the Map of objects, described here:
The LiteMap implementation supports the null key value.
Nested Class Summary | |
---|---|
static class |
LiteMap.EntryIterator
A simple Iterator for LiteMap Entry objects. |
protected class |
LiteMap.EntrySet
A Set of entries backed by this Map. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry |
Constructor Summary | |
---|---|
LiteMap()
Construct a LiteMap. |
|
LiteMap(Map map)
Construct a LiteMap with the same mappings as the given map. |
Method Summary | |
---|---|
protected void |
checkShrinkFromOther()
After a mutation operation has reduced the size of an underlying Map, check if the delegation model should be replaced with a more size- efficient storage approach, and switch accordingly. |
void |
clear()
Clear all key/value mappings. |
Object |
clone()
Create a clone of the ImmutableArrayList. |
boolean |
containsKey(Object oKey)
Returns true if this map contains a mapping for the specified key. |
Set |
entrySet()
Returns a set view of the mappings contained in this map. |
Object |
get(Object oKey)
Returns the value to which this map maps the specified key. |
protected Map.Entry |
instantiateEntry(Object key,
Object value)
(Factory pattern) Instantiate a Map Entry. |
protected Set |
instantiateEntrySet()
(Factory pattern) Instantiate an Entry Set. |
protected Map |
instantiateMap()
(Factory pattern) Instantiate a Map object to store entries in once the "lite" threshold has been exceeded. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
Object |
put(Object oKey,
Object oValue)
Associates the specified value with the specified key in this map. |
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(ObjectInput in)
Initialize this object from the data in the passed ObjectInput stream. |
Object |
remove(Object oKey)
Removes the mapping for this key from this map if present. |
int |
size()
Returns the number of key-value mappings in this map. |
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeExternal(ObjectOutput out)
Write this object's data to the passed ObjectOutput stream. |
Methods inherited from class java.util.AbstractMap |
---|
containsValue, equals, hashCode, keySet, putAll, toString, values |
Constructor Detail |
---|
public LiteMap()
public LiteMap(Map map)
map
- the map whose mappings are to be placed in this map.Method Detail |
---|
public boolean isEmpty()
isEmpty
in interface Map
isEmpty
in class AbstractMap
public int size()
size
in interface Map
size
in class AbstractMap
public boolean containsKey(Object oKey)
containsKey
in interface Map
containsKey
in class AbstractMap
public Object get(Object oKey)
get
in interface Map
get
in class AbstractMap
oKey
- the key object
public Object put(Object oKey, Object oValue)
put
in interface Map
put
in class AbstractMap
oKey
- key with which the specified value is to be associatedoValue
- value to be associated with the specified key
public Object remove(Object oKey)
remove
in interface Map
remove
in class AbstractMap
oKey
- key whose mapping is to be removed from the map
public void clear()
clear
in interface Map
clear
in class AbstractMap
public Object clone()
clone
in class AbstractMap
public Set entrySet()
Map Entry
. 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 by the iterator's own remove operation, or by 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 is not expected to
support the add or addAll operations.
entrySet
in interface Map
entrySet
in class AbstractMap
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- the stream to read data from in order to restore the object
IOException
- if an I/O exception occurs
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to write the object to
IOException
- if an I/O exception occurspublic void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore
the state of this object
IOException
- if an I/O exception occurs
NotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object to
IOException
- if an I/O exception occursprotected Map.Entry instantiateEntry(Object key, Object value)
protected Set instantiateEntrySet()
protected Map instantiateMap()
protected void checkShrinkFromOther()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |