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, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
Methods 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:
comparator
in interfaceSortedSet<E>
-
lower
- Specified by:
lower
in interfaceNavigableSet<E>
-
floor
- Specified by:
floor
in interfaceNavigableSet<E>
-
ceiling
- Specified by:
ceiling
in interfaceNavigableSet<E>
-
higher
- Specified by:
higher
in interfaceNavigableSet<E>
-
pollFirst
- Specified by:
pollFirst
in interfaceNavigableSet<E>
-
pollLast
- Specified by:
pollLast
in interfaceNavigableSet<E>
-
iterator
- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in interfaceNavigableSet<E>
- Specified by:
iterator
in interfaceSet<E>
- Specified by:
iterator
in classAbstractCollection<E>
-
descendingSet
- Specified by:
descendingSet
in interfaceNavigableSet<E>
-
descendingIterator
- Specified by:
descendingIterator
in interfaceNavigableSet<E>
-
subSet
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) - Specified by:
subSet
in interfaceNavigableSet<E>
-
headSet
- Specified by:
headSet
in interfaceNavigableSet<E>
-
tailSet
- Specified by:
tailSet
in interfaceNavigableSet<E>
-
subSet
-
headSet
-
tailSet
-
first
-
last
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceSet<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
add
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classAbstractCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classAbstractCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceSet<E>
- Overrides:
clear
in classAbstractCollection<E>
-