|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.util.AbstractMap
com.tangosol.util.SafeSortedMap.ViewMap
protected class SafeSortedMap.ViewMap
ViewMap provides a SortedMap view over a subset of the SafeSortedMap. A ViewMap may have an inclusive lower and/or an exclusive upper bound. <p/> For example, a ViewMap defined on an SafeSortedMap of Integer keys with lower bound 3 and upper bound 7 would contain any keys in the underlying SafeSortedMap in the range [3, 7).
Nested Class Summary | |
---|---|
protected class |
SafeSortedMap.ViewMap.EntryIterator An Iterator over the Entries backed by this ViewMap. |
protected class |
SafeSortedMap.ViewMap.EntrySet A Set of Entries backed by this ViewMap. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry |
Field Summary | |
---|---|
protected Object |
m_oKeyLower The key that this ViewMap is (inclusively) lower-bounded by, or null for no lower-bound. |
protected Object |
m_oKeyUpper The key that this ViewMap is (exclusively) upper-bounded by, or null for no upper-bound |
Constructor Summary | |
---|---|
protected |
SafeSortedMap.ViewMap(Object oKeyLower, Object oKeyUpper) Create a new ViewMap over the SafeSortedMap bounded by the specified keys, or null for no-bound. |
Method Summary | |
---|---|
Comparator |
comparator() Returns the comparator associated with this sorted map, or null if it uses its keys' natural ordering. |
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 |
firstKey() Returns the first (lowest) key currently in this sorted map. |
protected SafeSortedMap.EntryNode |
firstNode() Return the first Node in this ViewMap, or null if there are none. |
Object |
get(Object oKey) Returns the value to which this map maps the specified key. |
protected Object |
getLowerBound() Return the lower bound of this ViewMap. |
protected Object |
getUpperBound() Return the upper bound of this ViewMap. |
SortedMap |
headMap(Object toKey) Returns a view of the portion of this sorted map whose keys are strictly less than toKey. |
protected boolean |
inRange(Object oKey) Is the specified key in the range represented by this ViewMap? |
Object |
lastKey() Returns the last (highest) key currently in this sorted map. |
protected SafeSortedMap.EntryNode |
lastNode() Return the last SkipNode in this ViewMap, or null if there are none. |
Object |
put(Object oKey, Object oValue) Associates the specified value with the specified key in this map (optional operation). |
Object |
remove(Object oKey) Removes the mapping for this key from this map if present (optional operation). |
SortedMap |
subMap(Object fromKey, Object toKey) Returns a view of the portion of this sorted map whose keys range from fromKey, inclusive, to toKey, exclusive. |
SortedMap |
tailMap(Object fromKey) Returns a view of the portion of this sorted map whose keys are greater than or equal to fromKey. |
Methods inherited from class java.util.AbstractMap |
---|
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values |
Methods inherited from interface java.util.Map |
---|
clear, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, values |
Field Detail |
---|
protected final Object m_oKeyLower
protected final Object m_oKeyUpper
Constructor Detail |
---|
protected SafeSortedMap.ViewMap(Object oKeyLower, Object oKeyUpper)
oKeyLower
- the (inclusive) lower-bound key, or nulloKeyUpper
- the (exclusive) upper-bound key, or nullMethod Detail |
---|
public Set entrySet()
entrySet
in interface Map
entrySet
in class AbstractMap
public Object put(Object oKey, Object oValue)
This implementation always throws an UnsupportedOperationException.
put
in interface Map
put
in class AbstractMap
oKey
- key with which the specified value is to be associated.oValue
- value to be associated with the specified key.public Object get(Object oKey)
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
oKey
- key whose associated value is to be returned.AbstractMap.containsKey(Object)
public boolean containsKey(Object oKey)
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
oKey
- key whose presence in this map is to be tested.public Object remove(Object oKey)
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, its value is obtained with its getValue operation, the entry is removed from the Collection (and the backing map) with the iterator's remove operation, and the saved 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.
Note that this implementation throws an UnsupportedOperationException if the entrySet iterator does not support the remove method and this map contains a mapping for the specified key.
remove
in interface Map
remove
in class AbstractMap
oKey
- key whose mapping is to be removed from the map.public Comparator comparator()
comparator
in interface SortedMap
public SortedMap subMap(Object fromKey, Object toKey)
The map returned by this method will throw an IllegalArgumentException if the user attempts to insert a key outside the specified range.
Note: this method always returns a half-open range (which includes its low endpoint but not its high endpoint). If you need a closed range (which includes both endpoints), and the key type allows for calculation of the successor a given key, merely request the subrange from lowEndpoint to successor(highEndpoint). For example, suppose that m is a map whose keys are strings. The following idiom obtains a view containing all of the key-value mappings in m whose keys are between low and high, inclusive:
Map sub = m.subMap(low, high+"\0");A similarly technique can be used to generate an open range (which contains neither endpoint). The following idiom obtains a view containing all of the key-value mappings in m whose keys are between low and high, exclusive:
Map sub = m.subMap(low+"\0", high);
subMap
in interface SortedMap
fromKey
- low endpoint (inclusive) of the subMap.toKey
- high endpoint (exclusive) of the subMap.public SortedMap headMap(Object toKey)
The map returned by this method will throw an IllegalArgumentException if the user attempts to insert a key outside the specified range.
Note: this method always returns a view that does not contain its (high) endpoint. If you need a view that does contain this endpoint, and the key type allows for calculation of the successor a given key, merely request a headMap bounded by successor(highEndpoint). For example, suppose that suppose that m is a map whose keys are strings. The following idiom obtains a view containing all of the key-value mappings in m whose keys are less than or equal to high:
Map head = m.headMap(high+"\0");
headMap
in interface SortedMap
toKey
- high endpoint (exclusive) of the subMap.public SortedMap tailMap(Object fromKey)
The map returned by this method will throw an IllegalArgumentException if the user attempts to insert a key outside the specified range.
Note: this method always returns a view that contains its (low) endpoint. If you need a view that does not contain this endpoint, and the element type allows for calculation of the successor a given value, merely request a tailMap bounded by successor(lowEndpoint). For example, suppose that suppose that m is a map whose keys are strings. The following idiom obtains a view containing all of the key-value mappings in m whose keys are strictly greater than low:
Map tail = m.tailMap(low+"\0");
tailMap
in interface SortedMap
fromKey
- low endpoint (inclusive) of the tailMap.public Object firstKey()
firstKey
in interface SortedMap
public Object lastKey()
lastKey
in interface SortedMap
protected Object getLowerBound()
protected Object getUpperBound()
protected boolean inRange(Object oKey)
oKey
- the key to test forprotected SafeSortedMap.EntryNode firstNode()
protected SafeSortedMap.EntryNode lastNode()
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |