|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.util.AbstractMap<K,V>
org.infinispan.util.BidirectionalLinkedHashMap<K,V>
public class BidirectionalLinkedHashMap<K,V>
Similar to the JDK's LinkedHashMap
except that this version makes use of the fact that entries are
bidirectionally linked and can hence be navigated either from the start or from the end. It exposes such
navigability by overriding Map.keySet()
and Map.entrySet()
to return ReversibleOrderedSet
rather than a standard JDK Set
. ReversibleOrderedSet
s allow you to
access 2 iterators: one that iterates from start to end, as usual, and a reversed one that iterates from end to start
instead.
LinkedHashMap
, this implementation does not support null keys.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.infinispan.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary |
---|
Fields inherited from class org.infinispan.util.AbstractMap |
---|
entrySet, keySet, values |
Constructor Summary | |
---|---|
BidirectionalLinkedHashMap()
Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75). |
|
BidirectionalLinkedHashMap(int initialCapacity)
Constructs an empty HashMap with the specified initial capacity and the default load factor (0.75). |
|
BidirectionalLinkedHashMap(int initialCapacity,
float loadFactor)
Constructs an empty HashMap with the specified initial capacity and load factor. |
|
BidirectionalLinkedHashMap(int initialCapacity,
float loadFactor,
boolean accessOrder)
Constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode. |
|
BidirectionalLinkedHashMap(Map<? extends K,? extends V> m)
Constructs a new HashMap with the same mappings as the specified Map. |
Method Summary | |
---|---|
void |
clear()
Removes all of the mappings from this map. |
BidirectionalLinkedHashMap |
clone()
Returns a shallow copy of this Map instance: the keys and values themselves are not cloned. |
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 the specified value. |
ReversibleOrderedSet<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the
key. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
ReversibleOrderedSet<K> |
keySet()
|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map. |
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to this map. |
V |
remove(Object key)
Removes the mapping for the specified key from this map if present. |
int |
size()
Returns the number of key-value mappings in this map. |
Collection<V> |
values()
|
Methods inherited from class org.infinispan.util.AbstractMap |
---|
assertKeyNotNull, eq, hash |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public BidirectionalLinkedHashMap(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacityloadFactor
- the load factor
IllegalArgumentException
- if the initial capacity is negative or the load factor is non-positivepublic BidirectionalLinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder)
initialCapacity
- the initial capacityloadFactor
- the load factoraccessOrder
- the ordering mode - true for access-order, false for insertion-order
IllegalArgumentException
- if the initial capacity is negative or the load factor is non-positivepublic BidirectionalLinkedHashMap(int initialCapacity)
initialCapacity
- the initial capacity.
IllegalArgumentException
- if the initial capacity is negative.public BidirectionalLinkedHashMap()
public BidirectionalLinkedHashMap(Map<? extends K,? extends V> m)
m
- the map whose mappings are to be placed in this map
NullPointerException
- if the specified map is nullMethod Detail |
---|
public int size()
size
in interface Map<K,V>
public boolean isEmpty()
isEmpty
in interface Map<K,V>
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
key
- The key whose presence in this map is to be tested
public V put(K key, V value)
put
in interface Map<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key
public void putAll(Map<? extends K,? extends V> m)
putAll
in interface Map<K,V>
m
- mappings to be stored in this map
NullPointerException
- if the specified map is nullpublic V remove(Object key)
remove
in interface Map<K,V>
key
- key whose mapping is to be removed from the map
public void clear()
clear
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
value
- value whose presence in this map is to be tested
public V get(Object key)
null
if this map contains no mapping for the
key.
More formally, if this map contains a mapping from a key k
to a value v
such that (key==null ? k==null : key.equals(k))
, then this method returns v
; otherwise it returns null
.
(There can be at most one such mapping.)
A return value of null
does not necessarily indicate that the map contains no mapping for the
key; it's also possible that the map explicitly maps the key to null
. The containsKey
operation may be used to distinguish these two cases.
get
in interface Map<K,V>
public Collection<V> values()
values
in interface Map<K,V>
public ReversibleOrderedSet<K> keySet()
keySet
in interface Map<K,V>
keySet
in interface BidirectionalMap<K,V>
public ReversibleOrderedSet<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
entrySet
in interface BidirectionalMap<K,V>
public BidirectionalLinkedHashMap clone()
clone
in class Object
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |