@Override public Object[] toArray() { return Iterate.toArray(this.adapted); }
public <T> ImmutableSortedSet<T> withAll(Iterable<? extends T> items) { if (items instanceof ImmutableSortedSet<?>) { return (ImmutableSortedSet<T>) items; } return this.of((T[]) Iterate.toArray(items)); }
public <T> ImmutableSortedBag<T> withAll(Iterable<? extends T> items) { if (items instanceof ImmutableSortedBag<?>) { return (ImmutableSortedBag<T>) items; } return this.of((T[]) Iterate.toArray(items)); }
public static <E> ImmutableArrayStack<E> newStack(Iterable<? extends E> iterable) { return new ImmutableArrayStack<E>((E[]) Iterate.toArray(iterable)); }
public <T> ImmutableSet<T> withAll(HashingStrategy<? super T> hashingStrategy, Iterable<? extends T> items) { return this.with(hashingStrategy, (T[]) Iterate.toArray(items)); } }
public <T> FixedSizeList<T> withAll(Iterable<? extends T> items) { return this.of((T[]) Iterate.toArray(items)); } }
public <T> ImmutableSortedBag<T> withAll(Comparator<? super T> comparator, Iterable<? extends T> items) { return this.of(comparator, (T[]) Iterate.toArray(items)); }
public static <E> FastList<E> newList(Iterable<? extends E> source) { return FastList.newListWith((E[]) Iterate.toArray(source)); }
public static <E> ImmutableArrayList<E> newList(Iterable<? extends E> iterable) { return new ImmutableArrayList<E>((E[]) Iterate.toArray(iterable)); }
public <T> ImmutableSortedSet<T> withAll(Comparator<? super T> comparator, Iterable<? extends T> items) { return this.of(comparator, (T[]) Iterate.toArray(items)); }
public static <E> ArrayAdapter<E> newArray(Iterable<? extends E> source) { return new ArrayAdapter<E>((E[]) Iterate.toArray(source)); }
public static <E> ArrayAdapter<E> newArrayWithItem(Iterable<? extends E> iterable, E itemToAdd) { int oldSize = Iterate.sizeOf(iterable); E[] array = (E[]) new Object[oldSize + 1]; Iterate.toArray(iterable, array); array[oldSize] = itemToAdd; return new ArrayAdapter<E>(array); }
public static <E> HashBag<E> newBag(Iterable<? extends E> source) { if (source instanceof Bag) { return HashBag.newBag((Bag<E>) source); } return HashBag.newBagWith((E[]) Iterate.toArray(source)); }
public <T> ImmutableSet<T> withAll(Iterable<? extends T> items) { if (items instanceof ImmutableSet<?>) { return (ImmutableSet<T>) items; } if (Iterate.isEmpty(items)) { return this.with(); } return this.with((T[]) Iterate.toArray(items)); } }
public <T> ImmutableList<T> withAll(Iterable<? extends T> items) { if (items instanceof ImmutableList<?>) { return (ImmutableList<T>) items; } if (items instanceof List && items instanceof RandomAccess) { return this.withList((List<T>) items); } if (Iterate.isEmpty(items)) { return this.empty(); } return this.of((T[]) Iterate.toArray(items)); } }
ArrayAdapter.adapt((T[]) Iterate.toArray(iterable)), procedureFactory, combiner,
ArrayAdapter.adapt((T[]) Iterate.toArray(iterable)), procedureFactory, combiner,
(T[]) Iterate.toArray(iterable), procedureFactory, combiner,
(T[]) Iterate.toArray(iterable), procedureFactory, combiner,
public <T> ImmutableBag<T> withAll(Iterable<? extends T> items) { if (items instanceof ImmutableBag<?>) { return (ImmutableBag<T>) items; } if (items instanceof Bag<?>) { Bag<T> bag = (Bag<T>) items; if (bag.isEmpty()) { return this.with(); } if (bag.size() == 1) { return this.with(bag.getFirst()); } if (bag.sizeDistinct() < ImmutableArrayBag.MAXIMUM_USEFUL_ARRAY_BAG_SIZE) { return ImmutableArrayBag.copyFrom(bag); } return new ImmutableHashBag<T>(bag); } return this.of((T[]) Iterate.toArray(items)); } }