com.google.common.collect.testing
Class SafeTreeSet<E>

java.lang.Object
  extended by com.google.common.collect.testing.SafeTreeSet<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, NavigableSet<E>, Set<E>, SortedSet<E>

public final class SafeTreeSet<E>
extends Object
implements Serializable, NavigableSet<E>

A wrapper around TreeSet 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
SafeTreeSet()
           
SafeTreeSet(Collection<? extends E> collection)
           
SafeTreeSet(Comparator<? super E> comparator)
           
SafeTreeSet(SortedSet<E> set)
           
 
Method Summary
 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
 

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

add

public boolean add(E element)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>

addAll

public boolean addAll(Collection<? extends E> collection)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>

ceiling

public E ceiling(E e)
Specified by:
ceiling in interface NavigableSet<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>

comparator

public Comparator<? super E> comparator()
Specified by:
comparator in interface SortedSet<E>

contains

public boolean contains(Object object)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

descendingIterator

public Iterator<E> descendingIterator()
Specified by:
descendingIterator in interface NavigableSet<E>

descendingSet

public NavigableSet<E> descendingSet()
Specified by:
descendingSet in interface NavigableSet<E>

first

public E first()
Specified by:
first in interface SortedSet<E>

floor

public E floor(E e)
Specified by:
floor in interface NavigableSet<E>

headSet

public SortedSet<E> headSet(E toElement)
Specified by:
headSet in interface NavigableSet<E>
Specified by:
headSet in interface SortedSet<E>

headSet

public NavigableSet<E> headSet(E toElement,
                               boolean inclusive)
Specified by:
headSet in interface NavigableSet<E>

higher

public E higher(E e)
Specified by:
higher in interface NavigableSet<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface NavigableSet<E>
Specified by:
iterator in interface Set<E>

last

public E last()
Specified by:
last in interface SortedSet<E>

lower

public E lower(E e)
Specified by:
lower in interface NavigableSet<E>

pollFirst

public E pollFirst()
Specified by:
pollFirst in interface NavigableSet<E>

pollLast

public E pollLast()
Specified by:
pollLast in interface NavigableSet<E>

remove

public boolean remove(Object object)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>

subSet

public NavigableSet<E> subSet(E fromElement,
                              boolean fromInclusive,
                              E toElement,
                              boolean toInclusive)
Specified by:
subSet in interface NavigableSet<E>

subSet

public SortedSet<E> subSet(E fromElement,
                           E toElement)
Specified by:
subSet in interface NavigableSet<E>
Specified by:
subSet in interface SortedSet<E>

tailSet

public SortedSet<E> tailSet(E fromElement)
Specified by:
tailSet in interface NavigableSet<E>
Specified by:
tailSet in interface SortedSet<E>

tailSet

public NavigableSet<E> tailSet(E fromElement,
                               boolean inclusive)
Specified by:
tailSet in interface NavigableSet<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

equals

public boolean equals(Object obj)
Specified by:
equals in interface Collection<E>
Specified by:
equals in interface Set<E>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<E>
Specified by:
hashCode in interface Set<E>
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2012. All Rights Reserved.