|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractSet<E> org.infinispan.util.VisitableBidirectionalLinkedHashSet<E>
public class VisitableBidirectionalLinkedHashSet<E>
Similar to the JDK's LinkedHashSet
except that it sets the underlying LinkedHashMap
's accessOrder constructor parameter to true, allowing for recording of
visits. To do this, this implementation exposes a visit(Object)
method to visit a key.
Constructor Summary | |
---|---|
VisitableBidirectionalLinkedHashSet(boolean visitable)
Constructs a new, empty linked hash set with the default initial capacity (16) and load factor (0.75). |
|
VisitableBidirectionalLinkedHashSet(boolean visitable,
Collection<? extends E> c)
Constructs a new linked hash set with the same elements as the specified collection. |
|
VisitableBidirectionalLinkedHashSet(boolean visitable,
int initialCapacity)
Constructs a new, empty linked hash set with the specified initial capacity and the default load factor (0.75). |
|
VisitableBidirectionalLinkedHashSet(boolean visitable,
int initialCapacity,
float loadFactor)
Constructs a new, empty linked hash set with the specified initial capacity and load factor. |
Method Summary | |
---|---|
boolean |
add(E e)
Adds the specified element to this set if it is not already present. |
void |
clear()
Removes all of the elements from this set. |
VisitableBidirectionalLinkedHashSet |
clone()
|
boolean |
contains(Object o)
Returns true if this set contains the specified element. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
Iterator<E> |
iterator()
Returns an iterator over the elements in this set. |
boolean |
remove(Object o)
Removes the specified element from this set if it is present. |
Iterator<E> |
reverseIterator()
|
int |
size()
Returns the number of elements in this set (its cardinality). |
void |
visit(E key)
Visits the key in the underlying Map, by performing a Map.get(Object) . |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public VisitableBidirectionalLinkedHashSet(boolean visitable, int initialCapacity, float loadFactor)
visitable
- if true, visiting an element (using visit(Object)
) will cause that element to be
moved to the end of the linked list that connects entries.initialCapacity
- the initial capacity of the linked hash setloadFactor
- the load factor of the linked hash set
IllegalArgumentException
- if the initial capacity is less than zero, or if the load factor is nonpositivepublic VisitableBidirectionalLinkedHashSet(boolean visitable, int initialCapacity)
visitable
- if true, visiting an element (using visit(Object)
) will cause that element to be
moved to the end of the linked list that connects entries.initialCapacity
- the initial capacity of the LinkedHashSet
IllegalArgumentException
- if the initial capacity is less than zeropublic VisitableBidirectionalLinkedHashSet(boolean visitable)
visitable
- if true, visiting an element (using visit(Object)
) will cause that element to be moved
to the end of the linked list that connects entries.public VisitableBidirectionalLinkedHashSet(boolean visitable, Collection<? extends E> c)
visitable
- if true, visiting an element (using visit(Object)
) will cause that element to be moved
to the end of the linked list that connects entries.c
- the collection whose elements are to be placed into this set
NullPointerException
- if the specified collection is nullMethod Detail |
---|
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in interface Set<E>
iterator
in class AbstractCollection<E>
ConcurrentModificationException
public Iterator<E> reverseIterator()
reverseIterator
in interface ReversibleOrderedSet<E>
public int size()
size
in interface Collection<E>
size
in interface Set<E>
size
in class AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
isEmpty
in class AbstractCollection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface Set<E>
contains
in class AbstractCollection<E>
o
- element whose presence in this set is to be tested
public boolean add(E e)
add
in interface Collection<E>
add
in interface Set<E>
add
in class AbstractCollection<E>
e
- element to be added to this set
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class AbstractCollection<E>
o
- object to be removed from this set, if present
public void visit(E key)
Map.get(Object)
. This records the access
and updates the ordering accordingly.
key
- key to visitpublic void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class AbstractCollection<E>
public VisitableBidirectionalLinkedHashSet clone()
clone
in class Object
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |