Package org.apache.ignite.internal.util
Class GridConcurrentSkipListSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.apache.ignite.internal.util.GridSerializableSet<E>
-
- org.apache.ignite.internal.util.GridConcurrentSkipListSet<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,NavigableSet<E>,Set<E>,SortedSet<E>
- Direct Known Subclasses:
GridBoundedConcurrentOrderedSet
public class GridConcurrentSkipListSet<E> extends GridSerializableSet<E> implements NavigableSet<E>, Cloneable
This class provided the same logic asConcurrentSkipListSet. It adds methodsfirstx()andlastx(), which unlikefirst()andlast()methods returnnullfor empty sets instead of throwingNoSuchElementException.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridConcurrentSkipListSet()Constructs a new, empty set that orders its elements according to their natural ordering.GridConcurrentSkipListSet(Collection<? extends E> c)Constructs a new set containing the elements in the specified collection, that orders its elements according to their natural ordering.GridConcurrentSkipListSet(Comparator<? super E> comp)Constructs a new, empty set that orders its elements according to the specified comparator.GridConcurrentSkipListSet(SortedSet<E> s)Constructs a new set containing the same elements and using the same ordering as the specified sorted set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)Eceiling(E e)voidclear()GridConcurrentSkipListSet<E>clone()Comparator<? super E>comparator()booleancontains(Object o)Iterator<E>descendingIterator()NavigableSet<E>descendingSet()booleanequals(Object o)Efirst()Efirstx()Same asfirst(), but returnsnullif set is empty.Efloor(E e)inthashCode()NavigableSet<E>headSet(E toElement)NavigableSet<E>headSet(E toElement, boolean inclusive)Ehigher(E e)booleanisEmpty()Iterator<E>iterator()Elast()Elastx()Same aslast(), but returnsnullif set is empty.Elower(E e)EpollFirst()EpollLast()booleanremove(Object o)booleanremoveAll(Collection<?> c)intsize()NavigableSet<E>subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)NavigableSet<E>subSet(E fromElement, E toElement)NavigableSet<E>tailSet(E fromElement)NavigableSet<E>tailSet(E fromElement, boolean inclusive)-
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.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.SortedSet
spliterator
-
-
-
-
Constructor Detail
-
GridConcurrentSkipListSet
public GridConcurrentSkipListSet()
Constructs a new, empty set that orders its elements according to their natural ordering.
-
GridConcurrentSkipListSet
public GridConcurrentSkipListSet(Comparator<? super E> comp)
Constructs a new, empty set that orders its elements according to the specified comparator.- Parameters:
comp- the comparator that will be used to order this set. If null, the natural ordering of the elements will be used.
-
GridConcurrentSkipListSet
public GridConcurrentSkipListSet(Collection<? extends E> c)
Constructs a new set containing the elements in the specified collection, that orders its elements according to their natural ordering.- Parameters:
c- The elements that will comprise the new set- Throws:
ClassCastException- if the elements in c are notComparable, or are not mutually comparableNullPointerException- if the specified collection or any of its elements are null
-
GridConcurrentSkipListSet
public GridConcurrentSkipListSet(SortedSet<E> s)
Constructs a new set containing the same elements and using the same ordering as the specified sorted set.- Parameters:
s- sorted set whose elements will comprise the new set- Throws:
NullPointerException- if the specified sorted set or any of its elements are null
-
-
Method Detail
-
clone
public GridConcurrentSkipListSet<E> clone()
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
add
public boolean add(E e)
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollection<E>
-
iterator
public Iterator<E> iterator()
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin interfaceNavigableSet<E>- Specified by:
iteratorin interfaceSet<E>- Specified by:
iteratorin classAbstractCollection<E>
-
descendingIterator
public Iterator<E> descendingIterator()
- Specified by:
descendingIteratorin interfaceNavigableSet<E>
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceSet<E>- Overrides:
equalsin classAbstractSet<E>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceSet<E>- Overrides:
hashCodein classAbstractSet<E>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
lower
public E lower(E e)
- Specified by:
lowerin interfaceNavigableSet<E>
-
floor
public E floor(E e)
- Specified by:
floorin interfaceNavigableSet<E>
-
ceiling
public E ceiling(E e)
- Specified by:
ceilingin interfaceNavigableSet<E>
-
higher
public E higher(E e)
- Specified by:
higherin interfaceNavigableSet<E>
-
pollFirst
@Nullable public E pollFirst()
- Specified by:
pollFirstin interfaceNavigableSet<E>
-
pollLast
@Nullable public E pollLast()
- Specified by:
pollLastin interfaceNavigableSet<E>
-
comparator
public Comparator<? super E> comparator()
- Specified by:
comparatorin interfaceSortedSet<E>
-
firstx
@Nullable public E firstx()
Same asfirst(), but returnsnullif set is empty.- Returns:
- First entry or
nullif set is empty.
-
lastx
@Nullable public E lastx()
Same aslast(), but returnsnullif set is empty.- Returns:
- Last entry or
nullif set is empty.
-
subSet
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- Specified by:
subSetin interfaceNavigableSet<E>
-
headSet
public NavigableSet<E> headSet(E toElement, boolean inclusive)
- Specified by:
headSetin interfaceNavigableSet<E>
-
tailSet
public NavigableSet<E> tailSet(E fromElement, boolean inclusive)
- Specified by:
tailSetin interfaceNavigableSet<E>
-
subSet
public NavigableSet<E> subSet(E fromElement, E toElement)
-
headSet
public NavigableSet<E> headSet(E toElement)
-
tailSet
public NavigableSet<E> tailSet(E fromElement)
-
descendingSet
public NavigableSet<E> descendingSet()
- Specified by:
descendingSetin interfaceNavigableSet<E>
-
-