code: public final SortedSet<T> toSortedSet(final Comparator<? super T> comparator) {
          return ImmutableSortedSet.copyOf(comparator,
                  toCollection(Lists.<T>newArrayListWithCapacity(256)));
      }
docs: Terminal operation returning an immutable SortedSet with all the elements of this Stream,
  sorted using the supplied {@code Comparator}. Use {@link Ordering#natural()} to sort
  Comparable elements based on {@link Comparable#compareTo(Object)} order. Call this method
  only if there is enough memory to hold the resulting SortedSet.
  
  @param comparator
  the {@code Comparator} to sort elements, not null
  @return the resulting immutable SortedSet