public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
@Override public <V, R extends Collection<V>> R flatCollect( Function<? super T, ? extends Iterable<V>> function, R target) { Iterate.addAllTo(function.valueOf(this.value), target); return target; }
public static <T, V, R extends Collection<V>> R flatCollect( T[] array, int size, Function<? super T, ? extends Iterable<V>> function, R target) { for (int i = 0; i < size; i++) { Iterate.addAllTo(function.valueOf(array[i]), target); } return target; }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { Iterate.addAllTo(function.valueOf(this.value1), target); return target; }
/** * @see Iterate#flatCollect(Iterable, Function, Collection) */ public static <T, V, R extends Collection<V>> R flatCollect( Iterator<T> iterator, Function<? super T, ? extends Iterable<V>> function, R targetCollection) { while (iterator.hasNext()) { Iterate.addAllTo(function.valueOf(iterator.next()), targetCollection); } return targetCollection; }
/** * @see Iterate#flatCollect(Iterable, Function, Collection) */ public static <T, A, R extends Collection<A>> R flatCollect( List<T> list, Function<? super T, ? extends Iterable<A>> function, R targetCollection) { int size = list.size(); for (int i = 0; i < size; i++) { Iterate.addAllTo(function.valueOf(list.get(i)), targetCollection); } return targetCollection; }
public static <E> TreeBag<E> newBag(Iterable<? extends E> source) { if (source instanceof SortedBag<?>) { return new TreeBag<E>((SortedBag<E>) source); } return Iterate.addAllTo(source, TreeBag.<E>newBag()); }
public <VV, R extends Collection<VV>> R flatCollect(Function<? super V, ? extends Iterable<VV>> function, R target) { if (this.sentinelValues != null) { if (this.sentinelValues.containsZeroKey) { Iterate.addAllTo(function.valueOf(this.sentinelValues.zeroValue), target); } if (this.sentinelValues.containsOneKey) { Iterate.addAllTo(function.valueOf(this.sentinelValues.oneValue), target); } } for (int i = 0; i < this.keys.length; i++) { if (isNonSentinel(this.keys[i])) { Iterate.addAllTo(function.valueOf(this.values[i]), target); } } return target; }
public void value(K key, C iterable) { R newCollection = collectionFactory.value(); Iterate.addAllTo(iterable, newCollection); result.put(key, newCollection); } });
public ImmutableBag<T> newWithAll(Iterable<? extends T> elements) { return Iterate.addAllTo(elements, HashBag.newBag(this.delegate)).toImmutable(); }
public ImmutableBag<T> newWithAll(Iterable<? extends T> elements) { return Bags.immutable.withAll(Iterate.addAllTo(elements, HashBag.newBag(this))); }
/** * Copies the specified iterable into the specified array. */ public static <T> T[] toArray(Iterable<? extends T> iterable, T[] target) { if (iterable instanceof Collection) { return ((Collection<T>) iterable).toArray(target); } if (iterable instanceof RichIterable) { return ((RichIterable<T>) iterable).toArray(target); } MutableList<T> result = Lists.mutable.empty(); Iterate.addAllTo(iterable, result); return result.toArray(target); }
/** * @see Iterate#flatCollect(Iterable, Function, Collection) */ public static <T, A, R extends Collection<A>> R flatCollect( ArrayList<T> list, Function<? super T, ? extends Iterable<A>> function, R targetCollection) { int size = list.size(); if (ArrayListIterate.isOptimizableArrayList(list, size)) { T[] elements = ArrayListIterate.getInternalArray(list); for (int i = 0; i < size; i++) { Iterate.addAllTo(function.valueOf(elements[i]), targetCollection); } return targetCollection; } return RandomAccessListIterate.flatCollect(list, function, targetCollection); }
private boolean putAllNotEmpty(K key, Iterable<? extends V> values) { C collection = this.getIfAbsentPutCollection(key); int oldSize = collection.size(); int newSize = Iterate.addAllTo(values, collection).size(); this.addToTotalSize(newSize - oldSize); return newSize > oldSize; }
public C replaceValues(K key, Iterable<? extends V> values) { if (Iterate.isEmpty(values)) { return this.removeAll(key); } C newValues = Iterate.addAllTo(values, this.createCollection()); C oldValues = this.map.put(key, newValues); oldValues = oldValues == null ? this.createCollection() : oldValues; this.addToTotalSize(newValues.size() - oldValues.size()); return (C) oldValues.asUnmodifiable(); }