public class PersistentTreeSet<E> extends AbstractUnmodSet<E> implements ImSortedSet<E>, Serializable
| Modifier and Type | Field and Description |
|---|---|
static PersistentTreeSet |
EMPTY
Be extremely careful with this because it uses the default comparator, which only works for
items that implement Comparable (have a "natural ordering").
|
| Modifier and Type | Method and Description |
|---|---|
Comparator<? super E> |
comparator()
Returns the comparator used to order the items in this set, or null if it uses
Fn2.DEFAULT_COMPARATOR (for compatibility with java.util.SortedSet).
|
boolean |
contains(Object o)
Returns true if the set contains the given item in O(log n) time.
|
static <T extends Comparable<T>> |
empty()
Be extremely careful with this because it uses the default comparator, which only works for
items that implement Comparable (have a "natural ordering").
|
boolean |
equals(Object other)
This is designed to be correct, rather than fully compatible with TreeSet.equals().
|
E |
first()
Use head() inherited from Sequence instead of this method which is inherited from SortedSet.
|
Option<E> |
head()
The first item in this iterable.
|
boolean |
isEmpty()
This is a convenience method inherited from Collection that returns true if size() == 0 (if
this set contains no elements).
|
UnmodSortedIterator<E> |
iterator()
Iterates over contents in a guaranteed order.
|
E |
last()
Inherited from SortedSet, returns the last item in this set, or throw an exception if this set
is empty.
|
static <T extends Comparable<T>> |
of(Iterable<T> items)
Returns a new PersistentTreeSet of the given comparable items.
|
static <T> PersistentTreeSet<T> |
ofComp(Comparator<? super T> comp)
Returns a new PersistentTreeSet of the given comparator.
|
static <T> PersistentTreeSet<T> |
ofComp(Comparator<? super T> comp,
Iterable<T> elements)
Returns a new PersistentTreeSet of the given comparator and items.
|
static <T> PersistentTreeSet<T> |
ofMap(ImSortedMap<T,?> i)
Returns a new PersistentTreeSet of the keys and comparator in the given map.
|
PersistentTreeSet<E> |
put(E e)
Adds an element.
|
int |
size()
The size of this set.
|
ImSortedSet<E> |
subSet(E fromElement,
E toElement)
Return the elements in this set from the start element (inclusive) to the end element
(exclusive)
|
ImSortedSet<E> |
tailSet(E fromElement) |
PersistentTreeSet<E> |
without(E key)
Removes this key from the set
|
hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitheadSet, unionadd, addAll, clear, containsAll, remove, removeAll, removeIf, retainAll, toArray, toArrayspliteratorparallelStream, streamcastFromList, castFromSortedMap, castFromSortedSet, equalconcat, drop, dropWhile, filter, flatMap, fold, foldUntil, hash, map, precat, take, takeWhile, toStringtoImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, toMutableRrbt, toMutableSet, toMutableSortedMap, toMutableSortedSetpublic static final PersistentTreeSet EMPTY
public static <T extends Comparable<T>> PersistentTreeSet<T> empty()
public static <T> PersistentTreeSet<T> ofComp(Comparator<? super T> comp)
public static <T> PersistentTreeSet<T> ofComp(Comparator<? super T> comp, Iterable<T> elements)
comp - A comparator that defines the sort order of elements in the new set. This
becomes part of the set (it's not for pre-sorting).elements - items to go into the set. In the case of a duplicate element, later
values in the input list overwrite the earlier ones.public static <T extends Comparable<T>> PersistentTreeSet<T> of(Iterable<T> items)
public static <T> PersistentTreeSet<T> ofMap(ImSortedMap<T,?> i)
public Comparator<? super E> comparator()
comparator in interface SortedSet<E>public boolean contains(Object o)
public PersistentTreeSet<E> without(E key)
public UnmodSortedIterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface Set<E>iterator in interface ImSortedSet<E>iterator in interface UnmodCollection<E>iterator in interface UnmodIterable<E>iterator in interface UnmodSet<E>iterator in interface UnmodSortedCollection<E>iterator in interface UnmodSortedIterable<E>iterator in interface UnmodSortedSet<E>public boolean equals(Object other)
equals in interface Collection<E>equals in interface Set<E>equals in class AbstractUnmodSet<E>public E first()
public Option<E> head()
head in interface UnmodIterable<E>head in interface Transformable<E>public boolean isEmpty()
public E last()
public PersistentTreeSet<E> put(E e)
public int size()
public ImSortedSet<E> subSet(E fromElement, E toElement)
subSet in interface SortedSet<E>subSet in interface ImSortedSet<E>subSet in interface UnmodSortedSet<E>public ImSortedSet<E> tailSet(E fromElement)
tailSet in interface SortedSet<E>tailSet in interface ImSortedSet<E>tailSet in interface UnmodSortedSet<E>Copyright © 2019. All rights reserved.