E
- Entry typepublic class FoldedTreeSet<E> extends Object implements SortedSet<E>
Constructor and Description |
---|
FoldedTreeSet()
Create a new TreeSet that uses the natural ordering of objects.
|
FoldedTreeSet(Comparator<E> comparator)
Create a new TreeSet that orders the elements using the supplied
Comparator.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E entry) |
boolean |
addAll(Collection<? extends E> c) |
E |
addOrReplace(E entry)
Add or replace an entry in the TreeSet.
|
boolean |
addSortedLast(E entry)
Insert an entry last in the sorted tree.
|
void |
clear() |
boolean |
compact(long timeout)
Compact all the entries to use the fewest number of nodes in the tree.
|
Comparator<? super E> |
comparator() |
boolean |
contains(Object obj) |
boolean |
containsAll(Collection<?> c) |
double |
fillRatio()
Returns the current size divided by the capacity of the tree.
|
E |
first() |
E |
get(E entry)
Lookup and return a stored object.
|
E |
get(Object obj,
Comparator<?> cmp)
Lookup and return a stored object using a user provided comparator.
|
SortedSet<E> |
headSet(E toElement) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
E |
last() |
boolean |
remove(Object obj) |
boolean |
remove(Object obj,
Comparator<?> cmp)
Remove object using a provided comparator.
|
boolean |
removeAll(Collection<?> c) |
E |
removeAndGet(Object obj)
Remove object and return the removed entry.
|
E |
removeAndGet(Object obj,
Comparator<?> cmp)
Remove object using a provided comparator, and return the removed entry.
|
boolean |
retainAll(Collection<?> c) |
int |
size() |
SortedSet<E> |
subSet(E fromElement,
E toElement) |
SortedSet<E> |
tailSet(E fromElement) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
spliterator
parallelStream, removeIf, stream
public FoldedTreeSet()
public FoldedTreeSet(Comparator<E> comparator)
comparator
- Comparator able to compare elements of type Epublic Comparator<? super E> comparator()
comparator
in interface SortedSet<E>
public int size()
public boolean isEmpty()
public E get(Object obj, Comparator<?> cmp)
obj
- Lookup keycmp
- User provided Comparator. The comparator should expect that the
proved obj will always be the first method parameter and any
stored object will be the second parameter.public E get(E entry)
entry
- Lookup entrypublic boolean contains(Object obj)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public E addOrReplace(E entry)
entry
- Entry to add or replace/update.public boolean add(E entry)
public boolean addSortedLast(E entry)
entry
- entry to addpublic E removeAndGet(Object obj, Comparator<?> cmp)
obj
- Lookup entrycmp
- User provided Comparator. The comparator should expect that the
proved obj will always be the first method parameter and any
stored object will be the second parameter.public E removeAndGet(Object obj)
obj
- Lookup entrypublic boolean remove(Object obj, Comparator<?> cmp)
obj
- Lookup entrycmp
- User provided Comparator. The comparator should expect that the
proved obj will always be the first method parameter and any
stored object will be the second parameter.public boolean remove(Object obj)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean addAll(Collection<? extends E> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
public void clear()
public double fillRatio()
public boolean compact(long timeout)
timeout
- Maximum time to spend compacting the tree set in
milliseconds.Copyright © 2008–2020 Apache Software Foundation. All rights reserved.