Class SafeTreeSet<E>
- java.lang.Object
-
- com.google.common.collect.testing.SafeTreeSet<E>
-
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,NavigableSet<E>
,Set<E>
,SortedSet<E>
@GwtIncompatible public final class SafeTreeSet<E> extends Object implements Serializable, NavigableSet<E>
A wrapper aroundTreeSet
that aggressively checks to see if elements are mutually comparable. This implementation passes the navigable set test suites.- Author:
- Louis Wasserman
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SafeTreeSet()
SafeTreeSet(Collection<? extends E> collection)
SafeTreeSet(Comparator<? super E> comparator)
SafeTreeSet(SortedSet<E> set)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E element)
boolean
addAll(Collection<? extends E> collection)
E
ceiling(E e)
void
clear()
Comparator<? super E>
comparator()
boolean
contains(Object object)
boolean
containsAll(Collection<?> c)
Iterator<E>
descendingIterator()
NavigableSet<E>
descendingSet()
boolean
equals(Object obj)
E
first()
E
floor(E e)
int
hashCode()
SortedSet<E>
headSet(E toElement)
NavigableSet<E>
headSet(E toElement, boolean inclusive)
E
higher(E e)
boolean
isEmpty()
Iterator<E>
iterator()
E
last()
E
lower(E e)
E
pollFirst()
E
pollLast()
boolean
remove(Object object)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
NavigableSet<E>
subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
SortedSet<E>
subSet(E fromElement, E toElement)
SortedSet<E>
tailSet(E fromElement)
NavigableSet<E>
tailSet(E fromElement, boolean inclusive)
Object[]
toArray()
<T> T[]
toArray(T[] a)
String
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, toArray
-
Methods inherited from interface java.util.SortedSet
spliterator
-
-
-
-
Constructor Detail
-
SafeTreeSet
public SafeTreeSet()
-
SafeTreeSet
public SafeTreeSet(Collection<? extends E> collection)
-
SafeTreeSet
public SafeTreeSet(Comparator<? super E> comparator)
-
SafeTreeSet
public SafeTreeSet(SortedSet<E> set)
-
-
Method Detail
-
addAll
public boolean addAll(Collection<? extends E> collection)
-
clear
public void clear()
-
comparator
public Comparator<? super E> comparator()
- Specified by:
comparator
in interfaceSortedSet<E>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
-
descendingIterator
public Iterator<E> descendingIterator()
- Specified by:
descendingIterator
in interfaceNavigableSet<E>
-
descendingSet
public NavigableSet<E> descendingSet()
- Specified by:
descendingSet
in interfaceNavigableSet<E>
-
headSet
public NavigableSet<E> headSet(E toElement, boolean inclusive)
- Specified by:
headSet
in interfaceNavigableSet<E>
-
isEmpty
public boolean isEmpty()
-
pollFirst
public E pollFirst()
- Specified by:
pollFirst
in interfaceNavigableSet<E>
-
pollLast
public E pollLast()
- Specified by:
pollLast
in interfaceNavigableSet<E>
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
size
public int size()
-
subSet
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- Specified by:
subSet
in interfaceNavigableSet<E>
-
tailSet
public NavigableSet<E> tailSet(E fromElement, boolean inclusive)
- Specified by:
tailSet
in interfaceNavigableSet<E>
-
toArray
public <T> T[] toArray(T[] a)
-
hashCode
public int hashCode()
-
-