private static <E> ImmutableList<E> copyOfInternal( ArrayList<? extends E> list) { switch (list.size()) { case 0: return of(); case 1: return new SingletonImmutableList<E>(list.iterator().next()); default: return new RegularImmutableList<E>(nullChecked(list.toArray())); } }
private static <E> ImmutableList<E> copyOfInternal( ArrayList<? extends E> list) { switch (list.size()) { case 0: return of(); case 1: return new SingletonImmutableList<E>(list.iterator().next()); default: return new RegularImmutableList<E>(nullChecked(list.toArray())); } }