com.google.common.collect
Class ImmutableSortedSet.Factory<E>

java.lang.Object
  extended by com.google.common.collect.ImmutableSortedSet.Factory<E>
Enclosing class:
ImmutableSortedSet<E>

public static class ImmutableSortedSet.Factory<E>
extends Object

A factory for creating immutable sorted sets with an explicit comparator.

The factory is immutable and may be used to create multiple ImmutableSortedSet instances.


Constructor Summary
ImmutableSortedSet.Factory(Comparator<? super E> comparator)
          Creates a new factory.
 
Method Summary
 ImmutableSortedSet<E> copyOf(Iterable<? extends E> elements)
          Returns an immutable sorted set containing the given elements sorted by the factory's comparator.
 ImmutableSortedSet<E> copyOf(Iterator<? extends E> elements)
          Returns an immutable sorted set containing the given elements sorted by the factory's comparator.
 ImmutableSortedSet<E> of(E... elements)
          Returns an immutable sorted set containing the given elements sorted by the factory's comparator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableSortedSet.Factory

public ImmutableSortedSet.Factory(Comparator<? super E> comparator)
Creates a new factory. The returned factory is equivalent to the factory generated by ImmutableSortedSet.orderedBy(java.util.Comparator).

Throws:
NullPointerException - if comparator is null
Method Detail

of

public ImmutableSortedSet<E> of(E... elements)
Returns an immutable sorted set containing the given elements sorted by the factory's comparator. When multiple elements are equivalent according to the comparator, only the first one specified is included.

Throws:
NullPointerException - if any of elements is null

copyOf

public ImmutableSortedSet<E> copyOf(Iterable<? extends E> elements)
Returns an immutable sorted set containing the given elements sorted by the factory's comparator. When multiple elements are equivalent according to the comparator, only the first one specified is included.

Note: Despite what the method name suggests, if elements is an ImmutableSortedSet with an equivalent comparator, it may be returned instead of a copy.

Throws:
NullPointerException - if any of elements is null

copyOf

public ImmutableSortedSet<E> copyOf(Iterator<? extends E> elements)
Returns an immutable sorted set containing the given elements sorted by the factory's comparator. When multiple elements are equivalent according to the comparator, only the first one specified is included.

Throws:
NullPointerException - if any of elements is null