Top Inners Fields Constructors Methods
org.jboss.marshalling.util

public final Class FlatNavigableMap<K, V>

extends AbstractMap<K, V>
implements NavigableMap<K, V>
Class Inheritance
All Implemented Interfaces
java.util.NavigableMap, java.util.SortedMap, java.util.SequencedMap, java.util.Map
Imports
java.util.AbstractMap, .AbstractSet, .ArrayList, .Comparator, .Iterator, .List, .NavigableMap, .NavigableSet, .Set, .SortedMap

Author
David M. Lloyd

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Comparator<? super K>
private final List<Map.Entry<K, V>>
private final Set<Map.Entry<K, V>>

Constructor Summary

AccessConstructor and Description
public
FlatNavigableMap(final Comparator<? super K> comparator)

Method Summary

Modifier and TypeMethod and Description
public Map.Entry<K, V>
ceilingEntry(final K
the key
key
)

Implements java.util.NavigableMap.ceilingEntry.

Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
public K
ceilingKey(final K
the key
key
)

Implements java.util.NavigableMap.ceilingKey.

Returns the least key greater than or equal to the given key, or null if there is no such key.
public Comparator<? super K>
comparator()

Implements java.util.SortedMap.comparator.

Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.
public NavigableSet<K>
descendingKeySet()

Implements java.util.NavigableMap.descendingKeySet.

Returns a reverse order NavigableSet view of the keys contained in this map.
public NavigableMap<K, V>
descendingMap()

Implements java.util.NavigableMap.descendingMap.

Returns a reverse order view of the mappings contained in this map.
public Set<Map.Entry<K, V>>
entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.SortedMap.entrySet, java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.
public Map.Entry<K, V>
firstEntry()

Implements java.util.NavigableMap.firstEntry.

Returns a key-value mapping associated with the least key in this map, or null if the map is empty.
public K
firstKey()

Implements java.util.SortedMap.firstKey.

Returns the first (lowest) key currently in this map.
public Map.Entry<K, V>
floorEntry(final K
the key
key
)

Implements java.util.NavigableMap.floorEntry.

Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
public K
floorKey(final K
the key
key
)

Implements java.util.NavigableMap.floorKey.

Returns the greatest key less than or equal to the given key, or null if there is no such key.
public NavigableMap<K, V>
headMap(final K
high endpoint of the keys in the returned map
toKey
,
final boolean
true if the high endpoint is to be included in the returned view
inclusive
)

Implements java.util.NavigableMap.headMap.

Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey.
public SortedMap<K, V>
headMap(final K
high endpoint (exclusive) of the keys in the returned map
toKey
)

Implements java.util.NavigableMap.headMap.

Returns a view of the portion of this map whose keys are strictly less than toKey.
public Map.Entry<K, V>
higherEntry(final K
the key
key
)

Implements java.util.NavigableMap.higherEntry.

Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
public K
higherKey(final K
the key
key
)

Implements java.util.NavigableMap.higherKey.

Returns the least key strictly greater than the given key, or null if there is no such key.
public Map.Entry<K, V>
lastEntry()

Implements java.util.NavigableMap.lastEntry.

Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
public K
lastKey()

Implements java.util.SortedMap.lastKey.

Returns the last (highest) key currently in this map.
public Map.Entry<K, V>
lowerEntry(final K
the key
key
)

Implements java.util.NavigableMap.lowerEntry.

Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
public K
lowerKey(final K
the key
key
)

Implements java.util.NavigableMap.lowerKey.

Returns the greatest key strictly less than the given key, or null if there is no such key.
public Map.Entry<K, V>
pollFirstEntry()

Implements java.util.NavigableMap.pollFirstEntry.

Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.
public Map.Entry<K, V>
pollLastEntry()

Implements java.util.NavigableMap.pollLastEntry.

Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
public V
put(final K
key with which the specified value is to be associated
key
,
final V
value to be associated with the specified key
value
)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).
public NavigableMap<K, V>
subMap(final K
low endpoint of the keys in the returned map
fromKey
,
final boolean
true if the low endpoint is to be included in the returned view
fromInclusive
,
final K
high endpoint of the keys in the returned map
toKey
,
final boolean
true if the high endpoint is to be included in the returned view
toInclusive
)

Implements java.util.NavigableMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey to toKey.
public SortedMap<K, V>
subMap(final K
low endpoint (inclusive) of the keys in the returned map
fromKey
,
final K
high endpoint (exclusive) of the keys in the returned map
toKey
)

Implements java.util.NavigableMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
public NavigableMap<K, V>
tailMap(final K
low endpoint of the keys in the returned map
fromKey
,
final boolean
true if the low endpoint is to be included in the returned view
inclusive
)

Implements java.util.NavigableMap.tailMap.

Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey.
public SortedMap<K, V>
tailMap(final K
low endpoint (inclusive) of the keys in the returned map
fromKey
)

Implements java.util.NavigableMap.tailMap.

Returns a view of the portion of this map whose keys are greater than or equal to fromKey.
Inherited from java.util.AbstractMap:
clearclonecontainsKeycontainsValueequalsgethashCodeisEmptykeySetputAllremovesizetoStringvalues

Field Detail

comparatorback to summary
private final Comparator<? super K> comparator
entriesback to summary
private final List<Map.Entry<K, V>> entries
entrySetback to summary
private final Set<Map.Entry<K, V>> entrySet

Constructor Detail

FlatNavigableMapback to summary
public FlatNavigableMap(final Comparator<? super K> comparator)

Method Detail

ceilingEntryback to summary
public Map.Entry<K, V> ceilingEntry(final K key)

Implements java.util.NavigableMap.ceilingEntry.

Doc from java.util.NavigableMap.ceilingEntry.

Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:Map.Entry<K, V>

an entry with the least key greater than or equal to key, or null if there is no such key

ceilingKeyback to summary
public K ceilingKey(final K key)

Implements java.util.NavigableMap.ceilingKey.

Doc from java.util.NavigableMap.ceilingKey.

Returns the least key greater than or equal to the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:K

the least key greater than or equal to key, or null if there is no such key

comparatorback to summary
public Comparator<? super K> comparator()

Implements java.util.SortedMap.comparator.

Doc from java.util.SortedMap.comparator.

Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.

Returns:Comparator<? super K>

the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys

descendingKeySetback to summary
public NavigableSet<K> descendingKeySet()

Implements java.util.NavigableMap.descendingKeySet.

Doc from java.util.NavigableMap.descendingKeySet.

Returns a reverse order NavigableSet view of the keys contained in this map. The set's iterator returns the keys in descending order. 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 through the iterator's own remove operation), 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 does not support the add or addAll operations.

Returns:NavigableSet<K>

a reverse order navigable set view of the keys in this map

descendingMapback to summary
public NavigableMap<K, V> descendingMap()

Implements java.util.NavigableMap.descendingMap.

Doc from java.util.NavigableMap.descendingMap.

Returns a reverse order view of the mappings contained in this map. The descending map is backed by this map, so changes to the map are reflected in the descending map, and vice-versa. If either map is modified while an iteration over a collection view of either map is in progress (except through the iterator's own remove operation), the results of the iteration are undefined.

The returned map has an ordering equivalent to Collections.reverseOrder(comparator()). The expression m.descendingMap().descendingMap() returns a view of m essentially equivalent to m.

Returns:NavigableMap<K, V>

a reverse order view of this map

entrySetback to summary
public Set<Map.Entry<K, V>> entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.SortedMap.entrySet, java.util.Map.entrySet.

Doc from java.util.SortedMap.entrySet.

Returns a Set view of the mappings contained in this map. The set's iterator returns the entries in ascending key order. 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 through the iterator's own remove operation, or through 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 does not support the add or addAll operations.

Returns:Set<Map.Entry<K, V>>

a set view of the mappings contained in this map, sorted in ascending key order

firstEntryback to summary
public Map.Entry<K, V> firstEntry()

Implements java.util.NavigableMap.firstEntry.

Doc from java.util.NavigableMap.firstEntry.

Returns a key-value mapping associated with the least key in this map, or null if the map is empty.

Returns:Map.Entry<K, V>

an entry with the least key, or null if this map is empty

firstKeyback to summary
public K firstKey()

Implements java.util.SortedMap.firstKey.

Doc from java.util.SortedMap.firstKey.

Returns the first (lowest) key currently in this map.

Returns:K

the first (lowest) key currently in this map

floorEntryback to summary
public Map.Entry<K, V> floorEntry(final K key)

Implements java.util.NavigableMap.floorEntry.

Doc from java.util.NavigableMap.floorEntry.

Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:Map.Entry<K, V>

an entry with the greatest key less than or equal to key, or null if there is no such key

floorKeyback to summary
public K floorKey(final K key)

Implements java.util.NavigableMap.floorKey.

Doc from java.util.NavigableMap.floorKey.

Returns the greatest key less than or equal to the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:K

the greatest key less than or equal to key, or null if there is no such key

headMapback to summary
public NavigableMap<K, V> headMap(final K toKey, final boolean inclusive)

Implements java.util.NavigableMap.headMap.

Doc from java.util.NavigableMap.headMap.

Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
toKey:K

high endpoint of the keys in the returned map

inclusive:boolean

true if the high endpoint is to be included in the returned view

Returns:NavigableMap<K, V>

a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey

headMapback to summary
public SortedMap<K, V> headMap(final K toKey)

Implements java.util.NavigableMap.headMap.

Doc from java.util.NavigableMap.headMap.

Returns a view of the portion of this map whose keys are strictly less than toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Equivalent to headMap(toKey, false).

Parameters
toKey:K

Doc from java.util.SortedMap.headMap.

high endpoint (exclusive) of the keys in the returned map

Returns:SortedMap<K, V>

Doc from java.util.SortedMap.headMap.

a view of the portion of this map whose keys are strictly less than toKey

higherEntryback to summary
public Map.Entry<K, V> higherEntry(final K key)

Implements java.util.NavigableMap.higherEntry.

Doc from java.util.NavigableMap.higherEntry.

Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:Map.Entry<K, V>

an entry with the least key greater than key, or null if there is no such key

higherKeyback to summary
public K higherKey(final K key)

Implements java.util.NavigableMap.higherKey.

Doc from java.util.NavigableMap.higherKey.

Returns the least key strictly greater than the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:K

the least key greater than key, or null if there is no such key

lastEntryback to summary
public Map.Entry<K, V> lastEntry()

Implements java.util.NavigableMap.lastEntry.

Doc from java.util.NavigableMap.lastEntry.

Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.

Returns:Map.Entry<K, V>

an entry with the greatest key, or null if this map is empty

lastKeyback to summary
public K lastKey()

Implements java.util.SortedMap.lastKey.

Doc from java.util.SortedMap.lastKey.

Returns the last (highest) key currently in this map.

Returns:K

the last (highest) key currently in this map

lowerEntryback to summary
public Map.Entry<K, V> lowerEntry(final K key)

Implements java.util.NavigableMap.lowerEntry.

Doc from java.util.NavigableMap.lowerEntry.

Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:Map.Entry<K, V>

an entry with the greatest key less than key, or null if there is no such key

lowerKeyback to summary
public K lowerKey(final K key)

Implements java.util.NavigableMap.lowerKey.

Doc from java.util.NavigableMap.lowerKey.

Returns the greatest key strictly less than the given key, or null if there is no such key.

Parameters
key:K

the key

Returns:K

the greatest key less than key, or null if there is no such key

pollFirstEntryback to summary
public Map.Entry<K, V> pollFirstEntry()

Implements java.util.NavigableMap.pollFirstEntry.

Doc from java.util.NavigableMap.pollFirstEntry.

Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.

Returns:Map.Entry<K, V>

the removed first entry of this map, or null if this map is empty

pollLastEntryback to summary
public Map.Entry<K, V> pollLastEntry()

Implements java.util.NavigableMap.pollLastEntry.

Doc from java.util.NavigableMap.pollLastEntry.

Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.

Returns:Map.Entry<K, V>

the removed last entry of this map, or null if this map is empty

putback to summary
public V put(final K key, final V value)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Doc from java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

Parameters
key:K

key with which the specified value is to be associated

value:V

value to be associated with the specified key

Returns:V

the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)

subMapback to summary
public NavigableMap<K, V> subMap(final K fromKey, final boolean fromInclusive, final K toKey, final boolean toInclusive)

Implements java.util.NavigableMap.subMap.

Doc from java.util.NavigableMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey to toKey. If fromKey and toKey are equal, the returned map is empty unless fromInclusive and toInclusive are both true. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside of its range, or to construct a submap either of whose endpoints lie outside its range.

Parameters
fromKey:K

low endpoint of the keys in the returned map

fromInclusive:boolean

true if the low endpoint is to be included in the returned view

toKey:K

high endpoint of the keys in the returned map

toInclusive:boolean

true if the high endpoint is to be included in the returned view

Returns:NavigableMap<K, V>

a view of the portion of this map whose keys range from fromKey to toKey

subMapback to summary
public SortedMap<K, V> subMap(final K fromKey, final K toKey)

Implements java.util.NavigableMap.subMap.

Doc from java.util.NavigableMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. (If fromKey and toKey are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Equivalent to subMap(fromKey, true, toKey, false).

Parameters
fromKey:K

Doc from java.util.SortedMap.subMap.

low endpoint (inclusive) of the keys in the returned map

toKey:K

Doc from java.util.SortedMap.subMap.

high endpoint (exclusive) of the keys in the returned map

Returns:SortedMap<K, V>

Doc from java.util.SortedMap.subMap.

a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive

tailMapback to summary
public NavigableMap<K, V> tailMap(final K fromKey, final boolean inclusive)

Implements java.util.NavigableMap.tailMap.

Doc from java.util.NavigableMap.tailMap.

Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
fromKey:K

low endpoint of the keys in the returned map

inclusive:boolean

true if the low endpoint is to be included in the returned view

Returns:NavigableMap<K, V>

a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey

tailMapback to summary
public SortedMap<K, V> tailMap(final K fromKey)

Implements java.util.NavigableMap.tailMap.

Doc from java.util.NavigableMap.tailMap.

Returns a view of the portion of this map whose keys are greater than or equal to fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Equivalent to tailMap(fromKey, true).

Parameters
fromKey:K

Doc from java.util.SortedMap.tailMap.

low endpoint (inclusive) of the keys in the returned map

Returns:SortedMap<K, V>

Doc from java.util.SortedMap.tailMap.

a view of the portion of this map whose keys are greater than or equal to fromKey

org.jboss.marshalling.util back to summary

pack-priv final Class FlatNavigableMap.EntryImpl<K, V>

extends Object
implements Map.Entry<K, V>
Class Inheritance
All Implemented Interfaces
java.util.Map.Entry

Field Summary

Modifier and TypeField and Description
private final K
private V

Constructor Summary

AccessConstructor and Description
pack-priv
EntryImpl(final K key, final V value)

Method Summary

Modifier and TypeMethod and Description
private static boolean
public final boolean
equals(final Object
object to be compared for equality with this map entry
obj
)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Compares the specified object with this entry for equality.
public final boolean
equals(final Map.Entry<?, ?> obj)

public K
getKey()

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.
public V
getValue()

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public final int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry.
private static int
public V
setValue(final V
new value to be stored in this entry
value
)

Implements java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation).
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

keyback to summary
private final K key
valueback to summary
private V value

Constructor Detail

EntryImplback to summary
pack-priv EntryImpl(final K key, final V value)

Method Detail

equalsback to summary
private static boolean equals(Object a, Object b)
equalsback to summary
public final boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Doc from java.util.Map.Entry.equals.

Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries represent the same mapping. More formally, two entries e1 and e2 represent the same mapping if

    (e1.getKey()==null ?
     e2.getKey()==null : e1.getKey().equals(e2.getKey()))  &&
    (e1.getValue()==null ?
     e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across different implementations of the Map.Entry interface.
Parameters
obj:Object

object to be compared for equality with this map entry

Returns:boolean

true if the specified object is equal to this map entry

equalsback to summary
public final boolean equals(final Map.Entry<?, ?> obj)
getKeyback to summary
public K getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:K

the key corresponding to this entry

getValueback to summary
public V getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:V

the value corresponding to this entry

hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Doc from java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry. The hash code of a map entry e is defined to be:

    (e.getKey()==null   ? 0 : e.getKey().hashCode()) ^
    (e.getValue()==null ? 0 : e.getValue().hashCode())
This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
Returns:int

the hash code value for this map entry

hashOfback to summary
private static int hashOf(Object obj)
setValueback to summary
public V setValue(final V value)

Implements java.util.Map.Entry.setValue.

Doc from java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).

Parameters
value:V

new value to be stored in this entry

Returns:V

old value corresponding to the entry

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.