guava/src/com/google/common/collect/ImmutableSortedSet.java
public static <E> ImmutableSortedSet<E> copyOf(
      Comparator<? super E> comparator, Iterator<? extends E> elements) {
    return new Builder<E>(comparator).addAll(elements).build();
  }
public static <E> ImmutableSortedSet<E> copyOf(
      Comparator<? super E> comparator, Iterator<? extends E> elements) {
    return new Builder<E>(comparator).addAll(elements).build();
  }
Returns an immutable sorted set containing the given elements sorted by the given {@code
Comparator}. When multiple elements are equivalent according to {@code compareTo()}, only the
first one specified is included.

@throws NullPointerException if {@code comparator} or any of {@code elements} is null