android/guava/src/com/google/common/collect/ImmutableList.java
public static <E> ImmutableList<E> copyOf(Collection<? extends E> elements) {
    if (elements instanceof ImmutableCollection) {
      @SuppressWarnings("unchecked") // all supported methods are covariant
      ImmutableList<E> list = ((ImmutableCollection<E>) elements).asList();
      return list.isPartialView() ? ImmutableList.<E>asImmutableList(list.toArray()) : list;
    }
    return construct(elements.toArray());
  }
public static <E> ImmutableList<E> copyOf(Collection<? extends E> elements) {
    if (elements instanceof ImmutableCollection) {
      @SuppressWarnings("unchecked") // all supported methods are covariant
      ImmutableList<E> list = ((ImmutableCollection<E>) elements).asList();
      return list.isPartialView() ? ImmutableList.<E>asImmutableList(list.toArray()) : list;
    }
    return construct(elements.toArray());
  }
Returns an immutable list containing the given elements, in order.

<p>Despite the method name, this method attempts to avoid actually copying the data when it is
safe to do so. The exact circumstances under which a copy will or will not be performed are
undocumented and subject to change.

<p>Note that if {@code list} is a {@code List<String>}, then {@code ImmutableList.copyOf(list)}
returns an {@code ImmutableList<String>} containing each of the strings in {@code list}, while
ImmutableList.of(list)} returns an {@code ImmutableList<List<String>>} containing one element
(the given list itself).

<p>This method is safe to use even when {@code elements} is a synchronized or concurrent
collection that is currently being modified by another thread.

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