// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }


import static net.ypresto.miniguava.base.Preconditions.checkNotNull;
import net.ypresto.miniguava.annotations.Beta;
import net.ypresto.miniguava.annotations.MiniGuavaSpecific;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Map;
        return ImmutableEnumSet.asImmutable(EnumSet.copyOf(elements));
      }
    }
  }

  /**
   * Returns an <b>immutable</b> list containing {@code elements} sorted by this
   * ordering. The input is not modified.
   *
   * <p>This method does not discard
   * elements that are duplicates according to the comparator. The sort
   * performed is <i>stable</i>, meaning that such elements will appear in the
   * returned list in the same order they appeared in {@code elements}.
   *
   * <p><b>Performance note:</b> According to our
   * benchmarking
   * on Open JDK 7, this method is the most efficient way to make a sorted copy
   * of a collection.
   *
   * @throws NullPointerException if any of {@code elements} (or {@code
   *     elements} itself) is null
   * @since 3.0
   * @see net.ypresto.miniguava.collect.Lists#sortedCopy(Collection, Comparator)
   */
  // miniguava: Rewritten for Collection instead of Iterable.
  @MiniGuavaSpecific(value = MiniGuavaSpecific.Reason.MOVED, from = "collect.Ordering#immutableSortedCopy")
  public static <E> ImmutableList<E> immutableSortedCopyOfList(Collection<E> elements, Comparator<? super E> comparator) {
    @SuppressWarnings("unchecked") // we'll only ever have E's in here
        E[] array = (E[]) elements.toArray();
    for (E e : array) {
// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }


// Path: miniguava-collect-immutables/src/main/java/net/ypresto/miniguava/collect/immutables/Immutables.java
import static net.ypresto.miniguava.base.Preconditions.checkNotNull;
import net.ypresto.miniguava.annotations.Beta;
import net.ypresto.miniguava.annotations.MiniGuavaSpecific;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Map;

        return ImmutableEnumSet.asImmutable(EnumSet.copyOf(elements));
      }
    }
  }

  /**
   * Returns an <b>immutable</b> list containing {@code elements} sorted by this
   * ordering. The input is not modified.
   *
   * <p>This method does not discard
   * elements that are duplicates according to the comparator. The sort
   * performed is <i>stable</i>, meaning that such elements will appear in the
   * returned list in the same order they appeared in {@code elements}.
   *
   * <p><b>Performance note:</b> According to our
   * benchmarking
   * on Open JDK 7, this method is the most efficient way to make a sorted copy
   * of a collection.
   *
   * @throws NullPointerException if any of {@code elements} (or {@code
   *     elements} itself) is null
   * @since 3.0
   * @see net.ypresto.miniguava.collect.Lists#sortedCopy(Collection, Comparator)
   */
  // miniguava: Rewritten for Collection instead of Iterable.
  @MiniGuavaSpecific(value = MiniGuavaSpecific.Reason.MOVED, from = "collect.Ordering#immutableSortedCopy")
  public static <E> ImmutableList<E> immutableSortedCopyOfList(Collection<E> elements, Comparator<? super E> comparator) {
    @SuppressWarnings("unchecked") // we'll only ever have E's in here
        E[] array = (E[]) elements.toArray();
    for (E e : array) {
      checkNotNull(e);