Package com.cedarsoftware.util
Class ConcurrentNavigableSetNullSafe<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.cedarsoftware.util.ConcurrentNavigableSetNullSafe<E>
- Type Parameters:
E- The type of elements maintained by this set
- All Implemented Interfaces:
Iterable<E>,Collection<E>,NavigableSet<E>,Set<E>,SortedSet<E>
ConcurrentNavigableSetNullSafe is a thread-safe implementation of NavigableSet
that allows null elements by using a unique sentinel value internally.
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
License
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, empty ConcurrentNavigableSetNullSafe with natural ordering of its elements.ConcurrentNavigableSetNullSafe(Collection<? extends E> c) Constructs a new ConcurrentNavigableSetNullSafe containing the elements in the specified collection.ConcurrentNavigableSetNullSafe(Collection<? extends E> c, Comparator<? super E> comparator) Constructs a new ConcurrentNavigableSetNullSafe containing the elements in the specified collection, ordered according to the provided comparator.ConcurrentNavigableSetNullSafe(Comparator<? super E> comparator) Constructs a new, empty ConcurrentNavigableSetNullSafe with the specified comparator. -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArrayMethods inherited from interface java.util.SortedSet
spliterator
-
Constructor Details
-
ConcurrentNavigableSetNullSafe
public ConcurrentNavigableSetNullSafe()Constructs a new, empty ConcurrentNavigableSetNullSafe with natural ordering of its elements. All elements inserted must implement the Comparable interface. -
ConcurrentNavigableSetNullSafe
Constructs a new, empty ConcurrentNavigableSetNullSafe with the specified comparator.- Parameters:
comparator- the comparator that will be used to order this set. If null, the natural ordering of the elements will be used.
-
ConcurrentNavigableSetNullSafe
Constructs a new ConcurrentNavigableSetNullSafe containing the elements in the specified collection.- Parameters:
c- the collection whose elements are to be placed into this set- Throws:
NullPointerException- if the specified collection is null
-
ConcurrentNavigableSetNullSafe
Constructs a new ConcurrentNavigableSetNullSafe containing the elements in the specified collection, ordered according to the provided comparator.- Parameters:
c- the collection whose elements are to be placed into this setcomparator- the comparator that will be used to order this set. If null, the natural ordering of the elements will be used.- Throws:
NullPointerException- if the specified collection is null
-
-
Method Details
-
comparator
- Specified by:
comparatorin interfaceSortedSet<E>
-
lower
- Specified by:
lowerin interfaceNavigableSet<E>
-
floor
- Specified by:
floorin interfaceNavigableSet<E>
-
ceiling
- Specified by:
ceilingin interfaceNavigableSet<E>
-
higher
- Specified by:
higherin interfaceNavigableSet<E>
-
pollFirst
- Specified by:
pollFirstin interfaceNavigableSet<E>
-
pollLast
- Specified by:
pollLastin interfaceNavigableSet<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>
-
descendingSet
- Specified by:
descendingSetin interfaceNavigableSet<E>
-
descendingIterator
- Specified by:
descendingIteratorin interfaceNavigableSet<E>
-
subSet
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) - Specified by:
subSetin interfaceNavigableSet<E>
-
headSet
- Specified by:
headSetin interfaceNavigableSet<E>
-
tailSet
- Specified by:
tailSetin interfaceNavigableSet<E>
-
subSet
-
headSet
-
tailSet
-
first
-
last
-
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
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>
-
remove
- 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>
-