Top Description Constructors Methods
org.eclipse.collections.impl.utility

public final Class Iterate

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, java.util.ArrayList, .Collection, .Comparator, .LinkedList, .List, .Map, .Optional, .RandomAccess, .SortedSet, java.util.function.BiConsumer, .Supplier, java.util.stream.Collector, .Stream, org.eclipse.collections.api.InternalIterable, .RichIterable, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, .Function3, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .DoubleObjectToDoubleFunction, .FloatFunction, .FloatObjectToFloatFunction, .IntFunction, .IntObjectToIntFunction, .LongFunction, .LongObjectToLongFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.factory.Lists, .Maps, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.map.MutableMap, .MutableMapIterable, org.eclipse.collections.api.map.primitive.ObjectDoubleMap, .ObjectLongMap, org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.api.multimap.bag.BagMultimap, org.eclipse.collections.api.multimap.list.ListMultimap, org.eclipse.collections.api.multimap.set.SetMultimap, org.eclipse.collections.api.partition.PartitionIterable, org.eclipse.collections.api.tuple.Pair, .Twin, org.eclipse.collections.impl.block.factory.Comparators, .Functions, .Predicates, .Procedures2, org.eclipse.collections.impl.block.procedure.MapCollectProcedure, .MaxComparatorProcedure, .MinComparatorProcedure, .MultimapKeyValuePutAllProcedure, .MultimapKeyValuePutProcedure, org.eclipse.collections.impl.list.mutable.FastList, org.eclipse.collections.impl.multimap.bag.HashBagMultimap, org.eclipse.collections.impl.multimap.list.FastListMultimap, org.eclipse.collections.impl.multimap.set.UnifiedSetMultimap, org.eclipse.collections.impl.parallel.BatchIterable, org.eclipse.collections.impl.utility.internal.DefaultSpeciesNewStrategy, .IterableIterate, .RandomAccessListIterate

A utility class that acts as a router to other utility classes to provide optimized iteration pattern implementations based on the type of Iterable. The lowest common denominator used will normally be IterableIterate. Iterate can be used when a JDK interface is the only type available to the developer, as it can determine the best way to iterate based on instanceof checks.
Since
1.0

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T> boolean
addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection)

Add all elements from the source Iterable to the target collection, returns true if any element was added.

public static <T, R extends Collection<T>> R
addAllTo(Iterable<? extends T> iterable, R targetCollection)

Add all elements from the source Iterable to the target collection, return the target collection.

public static <T, K, V, M extends Map<K, V>> M
addToMap(Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, M map)

Iterate over the specified collection applying a specific Function to each element to calculate a key, and add the results to input Map.

public static <T, K, V, M extends Map<K, V>> M
addToMap(Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, M map)

Iterate over the specified collection applying the specified Functions to each element to calculate a key and value, and add the results to input Map.

public static <T, K, V> MutableMap<K, V>
aggregateBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)

public static <T, K, V> MutableMap<K, V>
aggregateInPlaceBy(Iterable<T> iterable, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator)

public static <T> boolean
allSatisfy(Iterable<T> iterable, Predicate<? super T> predicate)

Returns true if the predicate evaluates to true for every element of the iterable, or returns false.

public static <T, P> boolean
allSatisfyWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Returns true if the predicate evaluates to true for every element of the iterable, or returns false.

public static <T> boolean
anySatisfy(Iterable<T> iterable, Predicate<? super T> predicate)

Returns true if the predicate evaluates to true for any element of the iterable.

public static <T, P> boolean
anySatisfyWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Returns true if the predicate2 and parameter evaluates to true for any element of the iterable.

public static <T> void
appendString(Iterable<T> iterable, Appendable appendable)

public static <T> void
appendString(Iterable<T> iterable, Appendable appendable, String separator)

public static <T> void
appendString(Iterable<T> iterable, Appendable appendable, String start, String separator, String end)

public static <T> RichIterable<RichIterable<T>>
chunk(Iterable<T> iterable, int size)

public static <T, V> Collection<V>
collect(Iterable<T> iterable, Function<? super T, ? extends V> function)

Returns a new collection with the results of applying the specified function for each element of the iterable.

public static <T, A, R extends Collection<A>> R
collect(Iterable<T> iterable, Function<? super T, ? extends A> function, R targetCollection)

Same as the collect(Iterable, Function) method with two parameters, except that the results are gathered into the specified targetCollection

Example using a Java 8 lambda expression:

MutableList<String> names =
     Iterate.
public static <T> MutableBooleanCollection
collectBoolean(Iterable<T> iterable, BooleanFunction<? super T> booleanFunction)

Returns a new primitive boolean collection with the results of applying the specified booleanFunction for each element of the iterable.

public static <T, R extends MutableBooleanCollection> R
collectBoolean(Iterable<T> iterable, BooleanFunction<? super T> booleanFunction, R target)

Same as collectBoolean(Iterable, BooleanFunction), except that the results are gathered into the specified target collection.

public static <T> MutableByteCollection
collectByte(Iterable<T> iterable, ByteFunction<? super T> byteFunction)

Returns a new byte collection with the results of applying the specified byteFunction for each element of the iterable.

public static <T, R extends MutableByteCollection> R
collectByte(Iterable<T> iterable, ByteFunction<? super T> byteFunction, R target)

Same as collectByte(Iterable, ByteFunction), except that the results are gathered into the specified target collection.

public static <T> MutableCharCollection
collectChar(Iterable<T> iterable, CharFunction<? super T> charFunction)

Returns a new char collection with the results of applying the specified charFunction for each element of the iterable.

public static <T, R extends MutableCharCollection> R
collectChar(Iterable<T> iterable, CharFunction<? super T> charFunction, R target)

Same as collectChar(Iterable, CharFunction), except that the results are gathered into the specified target collection.

public static <T> MutableDoubleCollection
collectDouble(Iterable<T> iterable, DoubleFunction<? super T> doubleFunction)

Returns a new double collection with the results of applying the specified doubleFunction for each element of the iterable.

public static <T, R extends MutableDoubleCollection> R
collectDouble(Iterable<T> iterable, DoubleFunction<? super T> doubleFunction, R target)

Same as collectDouble(Iterable, DoubleFunction), except that the results are gathered into the specified target collection.

public static <T> MutableFloatCollection
collectFloat(Iterable<T> iterable, FloatFunction<? super T> floatFunction)

Returns a new float collection with the results of applying the specified floatFunction for each element of the iterable.

public static <T, R extends MutableFloatCollection> R
collectFloat(Iterable<T> iterable, FloatFunction<? super T> floatFunction, R target)

Same as collectFloat(Iterable, FloatFunction), except that the results are gathered into the specified target collection.

public static <T, V> Collection<V>
collectIf(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function)

public static <T, V, R extends Collection<V>> R
collectIf(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function, R target)

public static <T> MutableIntCollection
collectInt(Iterable<T> iterable, IntFunction<? super T> intFunction)

Returns a new int collection with the results of applying the specified intFunction for each element of the iterable.

public static <T, R extends MutableIntCollection> R
collectInt(Iterable<T> iterable, IntFunction<? super T> intFunction, R target)

Same as collectInt(Iterable, IntFunction), except that the results are gathered into the specified target collection.

public static <T> MutableLongCollection
collectLong(Iterable<T> iterable, LongFunction<? super T> longFunction)

Returns a new long collection with the results of applying the specified longFunction for each element of the iterable.

public static <T, R extends MutableLongCollection> R
collectLong(Iterable<T> iterable, LongFunction<? super T> longFunction, R target)

Same as collectLong(Iterable, LongFunction), except that the results are gathered into the specified target collection.

public static <T> MutableShortCollection
collectShort(Iterable<T> iterable, ShortFunction<? super T> shortFunction)

Returns a new short collection with the results of applying the specified shortFunction for each element of the iterable.

public static <T, R extends MutableShortCollection> R
collectShort(Iterable<T> iterable, ShortFunction<? super T> shortFunction, R target)

Same as collectShort(Iterable, ShortFunction), except that the results are gathered into the specified target collection.

public static <T, P, A> Collection<A>
collectWith(Iterable<T> iterable, Function2<? super T, ? super P, ? extends A> function, P parameter)

Same as collect with a Function2 and specified parameter which is passed to the function.

public static <T, P, A, R extends Collection<A>> R
collectWith(Iterable<T> iterable, Function2<? super T, ? super P, ? extends A> function, P parameter, R targetCollection)

Same as collectWith but with a targetCollection parameter to gather the results.

public static boolean
contains(Iterable<?> iterable, Object value)

Returns true if the iterable contains the value.

public static <T> int
count(Iterable<T> iterable, Predicate<? super T> predicate)

Returns the total number of elements that evaluate to true for the specified predicate.

public static <T, IV> int
countWith(Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue)

Returns the total number of elements that evaluate to true for the specified predicate2 and parameter.

public static <T> T
detect(Iterable<T> iterable, Predicate<? super T> predicate)

Returns the first element of the iterable that evaluates to true for the specified predicate, or null if no element evaluates to true.

public static <T> T
detectIfNone(Iterable<T> iterable, Predicate<? super T> predicate, T ifNone)

Returns the first element of the iterable that evaluates to true for the specified predicate, or returns the result ifNone if no element evaluates to true.

public static <T> int
detectIndex(Iterable<T> iterable, Predicate<? super T> predicate)

Searches for the first occurrence where the predicate evaluates to true, returns -1 if the predicate does not evaluate to true.

public static <T, P> int
detectIndexWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Searches for the first occurrence where the predicate2 and parameter evaluates to true, returns -1 if the predicate2 and parameter do not evaluate to true.

public static <T> Optional<T>
detectOptional(Iterable<T> iterable, Predicate<? super T> predicate)

Returns the first element of the iterable that evaluates to true for the specified predicate as an Optional.

public static <T, P> T
detectWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter, or null if no element evaluates to true.

public static <T, P> T
detectWithIfNone(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter, T ifNone)

Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter, or returns the result ifNone if no element evaluates to true.

public static <T, P> Optional<T>
detectWithOptional(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter as an Optional.

public static <T> Collection<T>

Returns:

a new list with the items dropped from the given collection.
drop
(Iterable<T>
the collection to drop from.
iterable
,
int
the number of items to drop.
count
)

Returns a collection without the first count elements of the iterable or an empty iterable if the count is greater than the length of the iterable.

public static <T, V> Collection<V>
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function)

public static <T, A, R extends Collection<A>> R
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<A>> function, R targetCollection)

public static <T> Collection<T>

Returns:

A flattened list, e.g. { 1, 2, 3, 4, 5, 6 }
flatten
(Iterable<? extends Iterable<T>>
A list of lists, e.g. { { 1, 2, 3 }, { 4, 5 }, { 6 } }
iterable
)

Flattens a collection of collections into one "flat" collection.

public static <T, R extends Collection<T>> R
flatten(Iterable<? extends Iterable<T>> iterable, R targetCollection)

Same as flatten(Iterable) except that the results are gathered into the specified targetCollection.

public static <K, V> HashBagMultimap<V, K>
flip(BagMultimap<K, V> bagMultimap)

Flip the keys and values of the multimap.

public static <K, V> HashBagMultimap<V, K>
flip(ListMultimap<K, V> listMultimap)

Flip the keys and values of the multimap.

public static <K, V> UnifiedSetMultimap<V, K>
flip(SetMultimap<K, V> setMultimap)

Flip the keys and values of the multimap.

public static <T> void
forEach(Iterable<T> iterable, Procedure<? super T> procedure)

The procedure is evaluated for each element of the iterable.

public static <T, P> void
forEachWith(Iterable<T> iterable, Procedure2<? super T, ? super P> procedure, P parameter)

The procedure2 is evaluated for each element of the iterable with the specified parameter passed as the second argument.

public static <T> void
forEachWithIndex(Iterable<T> iterable, ObjectIntProcedure<? super T> objectIntProcedure)

Iterates over a collection passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

public static <T> T
getFirst(Iterable<T> iterable)

Returns the first element of a collection.

public static <T> T
getLast(Iterable<T> iterable)

Returns the last element of a collection.

public static <T> T
getOnly(Iterable<T> iterable)

Returns the only element of a collection.

public static <T, V> MutableMultimap<V, T>
groupBy(Iterable<T> iterable, Function<? super T, ? extends V> function)

public static <T, V, R extends MutableMultimap<V, T>> R
groupBy(Iterable<T> iterable, Function<? super T, ? extends V> function, R targetMultimap)

public static <T, K, V, R extends MutableMultimap<K, V>> R
groupByAndCollect(Iterable<T> iterable, Function<? super T, ? extends K> groupByFunction, Function<? super T, ? extends V> valueFunction, R targetMultimap)

Iterate over the specified collection applying the specified Functions to each element to calculate a key and value, add the results to targetMultimap and return the targetMultimap.

public static <T, V> MutableMultimap<V, T>
groupByEach(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function)

public static <T, V, R extends MutableMultimap<V, T>> R
groupByEach(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, R targetCollection)

public static <V, T> MutableMap<V, T>
groupByUniqueKey(Iterable<T> iterable, Function<? super T, ? extends V> function)

public static <V, T, R extends MutableMapIterable<V, T>> R
groupByUniqueKey(Iterable<T> iterable, Function<? super T, ? extends V> function, R target)

public static <T, IV> IV
injectInto(IV injectValue, Iterable<T> iterable, Function2<? super IV, ? super T, ? extends IV> function)

public static <T> int
injectInto(int injectValue, Iterable<T> iterable, IntObjectToIntFunction<? super T> function)

public static <T> long
injectInto(long injectValue, Iterable<T> iterable, LongObjectToLongFunction<? super T> function)

public static <T> double
injectInto(double injectValue, Iterable<T> iterable, DoubleObjectToDoubleFunction<? super T> function)

public static <T> float
injectInto(float injectValue, Iterable<T> iterable, FloatObjectToFloatFunction<? super T> function)

public static <T, IV, P> IV
injectIntoWith(IV injectValue, Iterable<T> iterable, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter)

Similar to injectInto(Object, Iterable, Function2), except with a parameter is used as third generic argument in function3.

public static boolean
isEmpty(Iterable<?> iterable)

A null-safe check on a collection to see if it isEmpty.

public static <T> String
makeString(Iterable<T> iterable)

public static <T> String
makeString(Iterable<T> iterable, String separator)

public static <T> String
makeString(Iterable<T> iterable, String start, String separator, String end)

public static <T> T
max(Iterable<T> iterable, Comparator<? super T> comparator)

public static <T> T
max(Iterable<T> iterable)

public static <T, V extends Comparable<? super V>> T
maxBy(Iterable<T> iterable, Function<? super T, ? extends V> function)

Returns the maximum element out of the iterable based on the natural order of the attribute returned by the function.

public static <T> T
min(Iterable<T> iterable, Comparator<? super T> comparator)

public static <T> T
min(Iterable<T> iterable)

public static <T, V extends Comparable<? super V>> T
minBy(Iterable<T> iterable, Function<? super T, ? extends V> function)

Returns the minimum element out of the iterable based on the natural order of the attribute returned by the function.

public static <T> boolean
noneSatisfy(Iterable<T> iterable, Predicate<? super T> predicate)

Returns true if the predicate evaluates to false for every element of the iterable, or returns false.

public static <T, P> boolean
noneSatisfyWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Returns true if the predicate evaluates to false for every element of the iterable, or returns false.

public static boolean
notEmpty(Iterable<?> iterable)

A null-safe check on a collection to see if it is notEmpty.

public static <T> PartitionIterable<T>
partition(Iterable<T> iterable, Predicate<? super T> predicate)

Filters a collection into a PartitionIterable based on a predicate.

public static <T, P> PartitionIterable<T>
partitionWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Filters a collection into a PartitionIterable based on a predicate.

public static <T, A, R> R
reduceInPlace(Iterable<T> iterable, Collector<? super T, A, R> collector)

This method produces the equivalent result as Stream#collect(Collector).

public static <T, R> R
reduceInPlace(Iterable<T> iterable, Supplier<R> supplier, BiConsumer<R, ? super T> accumulator)

This method produces the equivalent result as Stream#collect(Supplier, BiConsumer, BiConsumer).

public static <T> Collection<T>
reject(Iterable<T> iterable, Predicate<? super T> predicate)

Returns all elements of the iterable that evaluate to false for the specified predicate.

public static <T, R extends Collection<T>> R
reject(Iterable<T> iterable, Predicate<? super T> predicate, R targetCollection)

Same as the reject method with one parameter but uses the specified target collection for the results.

public static <T, P> Collection<T>
rejectWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Similar to reject(Iterable, Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public static <T, P, R extends Collection<T>> R
rejectWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)

Same as the reject method with two parameters but uses the specified target collection.

public static <T, R extends Collection<T>> R
removeAllFrom(Iterable<? extends T> iterable, R targetCollection)

Remove all elements present in Iterable from the target collection, return the target collection.

public static <T> boolean
removeAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection)

Remove all elements present in Iterable from the target collection, returns true if any element was removed.

public static <T> boolean
removeIf(Iterable<T> iterable, Predicate<? super T> predicate)

Removes all elements from the iterable that evaluate to true for the specified predicate.

public static <T, P> boolean
removeIfWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter)

Removes all elements of the iterable that evaluate to true for the specified predicate2 and parameter.

public static <T> Collection<T>
select(Iterable<T> iterable, Predicate<? super T> predicate)

Returns a new collection with only the elements that evaluated to true for the specified predicate.

public static <T, R extends Collection<T>> R
select(Iterable<T> iterable, Predicate<? super T> predicate, R targetCollection)

Same as the select method with two parameters but uses the specified target collection

Example using Java 8 lambda:

MutableList<Person> selected =
     Iterate.
public static <T, IV> Twin<MutableList<T>>
selectAndRejectWith(Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue)

Filters a collection into two separate collections based on a predicate returned via a Twin.

public static <T> Collection<T>
selectInstancesOf(Iterable<?> iterable, Class<T> clazz)

Returns a new collection with only the elements that are instances of the Class clazz.

public static <T, IV> Collection<T>
selectWith(Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV parameter)

Returns a new collection with only elements that evaluated to true for the specified predicate and parameter.

public static <T, P, R extends Collection<T>> R
selectWith(Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)

Same as the selectWith method with two parameters but uses the specified target collection.

public static int
sizeOf(Iterable<?> iterable)

Returns the size of an iterable.

public static <T extends Comparable<? super T>, L extends List<T>> L
sortThis(L list)

SortThis is a mutating method.

public static <T, L extends List<T>> L
sortThis(L list, Comparator<? super T> comparator)

SortThis is a mutating method.

public static <T, L extends List<T>> L
sortThis(L list, Predicate2<? super T, ? super T> predicate)

SortThis is a mutating method.

public static <T, V extends Comparable<? super V>, L extends List<T>> L
sortThisBy(L list, Function<? super T, ? extends V> function)

Sort the list by comparing an attribute defined by the function.

public static <V, T> MutableMap<V, BigDecimal>
sumByBigDecimal(Iterable<T> iterable, Function<T, V> groupBy, Function<? super T, BigDecimal> function)

Groups and sums the values of the iterable using the two specified functions.

public static <V, T> MutableMap<V, BigInteger>
sumByBigInteger(Iterable<T> iterable, Function<T, V> groupBy, Function<? super T, BigInteger> function)

Groups and sums the values of the iterable using the two specified functions.

public static <T, V> ObjectDoubleMap<V>
sumByDouble(Iterable<T> iterable, Function<T, V> groupBy, DoubleFunction<? super T> function)

public static <T, V> ObjectDoubleMap<V>
sumByFloat(Iterable<T> iterable, Function<T, V> groupBy, FloatFunction<? super T> function)

public static <T, V> ObjectLongMap<V>
sumByInt(Iterable<T> iterable, Function<T, V> groupBy, IntFunction<? super T> function)

public static <T, V> ObjectLongMap<V>
sumByLong(Iterable<T> iterable, Function<T, V> groupBy, LongFunction<? super T> function)

public static <T> BigDecimal
sumOfBigDecimal(Iterable<T> iterable, Function<? super T, BigDecimal> function)

Returns the BigDecimal sum of the result of applying the function to each element of the iterable.

public static <T> BigInteger
sumOfBigInteger(Iterable<T> iterable, Function<? super T, BigInteger> function)

Returns the BigInteger sum of the result of applying the function to each element of the iterable.

public static <T> double
sumOfDouble(Iterable<T> iterable, DoubleFunction<? super T> function)

public static <T> double
sumOfFloat(Iterable<T> iterable, FloatFunction<? super T> function)

public static <T> long
sumOfInt(Iterable<T> iterable, IntFunction<? super T> function)

public static <T> long
sumOfLong(Iterable<T> iterable, LongFunction<? super T> function)

public static <T> Collection<T>

Returns:

a new list with the items take from the given collection.
take
(Iterable<T>
the collection to take from.
iterable
,
int
the number of items to take.
count
)

Returns the first count elements of the iterable or all the elements in the iterable if count is greater than the length of the iterable.

public static <T> Object[]
toArray(Iterable<T> iterable)

Converts the specified iterable to an array.

public static <T> T[]
toArray(Iterable<? extends T> iterable, T[] target)

Copies the specified iterable into the specified array.

public static <T, K> MutableMap<K, T>
toMap(Iterable<T> iterable, Function<? super T, ? extends K> keyFunction)

Iterate over the specified collection applying the specified Function to each element to calculate a key and return the results as a Map.

public static <T, K, V> MutableMap<K, V>
toMap(Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)

Iterate over the specified collection applying the specified Functions to each element to calculate a key and value, and return the results as a Map.

public static <T, K, V, R extends Map<K, V>> R
toMap(Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, R target)

Iterate over the specified collection applying the specified Functions to each element to calculate a key and value, and return the results in the specified Map instance.

public static <T, K, V, R extends MutableMultimap<K, V>> R
toMultimap(Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends Iterable<V>> valuesFunction, R targetMultimap)

Iterate over the specified collection applying the specified Functions to each element to calculate a key and values, add the results to targetMultimap and return the targetMultimap.

public static <T extends Comparable<? super T>> MutableList<T>
toSortedList(Iterable<T> iterable)

Return the specified collection as a sorted List.

public static <T> MutableList<T>
toSortedList(Iterable<T> iterable, Comparator<? super T> comparator)

Return the specified collection as a sorted List using the specified Comparator.

public static <X, Y> Collection<Pair<X, Y>>
zip(Iterable<X> xs, Iterable<Y> ys)

public static <X, Y, R extends Collection<Pair<X, Y>>> R
zip(Iterable<X> xs, Iterable<Y> ys, R targetCollection)

public static <T> Collection<Pair<T, Integer>>
zipWithIndex(Iterable<T> iterable)

public static <T, R extends Collection<Pair<T, Integer>>> R
zipWithIndex(Iterable<T> iterable, R targetCollection)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait