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

public final Class ArrayIterate

extends Object
Class Inheritance
Imports
java.io.IOException, java.math.BigDecimal, .BigInteger, java.util.Arrays, .Collection, .Comparator, .List, .Optional, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.function.Function, .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.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.factory.Lists, .Maps, org.eclipse.collections.api.factory.primitive.BooleanLists, .ByteLists, .CharLists, .DoubleLists, .FloatLists, .IntLists, .LongLists, .ShortLists, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.list.primitive.MutableBooleanList, .MutableByteList, .MutableCharList, .MutableDoubleList, .MutableFloatList, .MutableIntList, .MutableLongList, .MutableShortList, 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.tuple.Pair, .Twin, org.eclipse.collections.impl.block.factory.Functions0, .Predicates2, .Procedures2, org.eclipse.collections.impl.block.procedure.MapCollectProcedure, org.eclipse.collections.impl.list.mutable.FastList, org.eclipse.collections.impl.multimap.list.FastListMultimap, org.eclipse.collections.impl.partition.list.PartitionFastList, org.eclipse.collections.impl.tuple.Tuples, org.eclipse.collections.impl.utility.internal.InternalArrayIterate

This utility class provides iteration pattern implementations that work with Java arrays.
Since
1.0

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T, R extends Collection<T>> R
addAllTo(T[] objectArray, R targetCollection)

public static <T> boolean
allSatisfy(T[] objectArray, Predicate<? super T> predicate)

public static <T, P> boolean
allSatisfyWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)

public static <T> boolean
anySatisfy(T[] objectArray, Predicate<? super T> predicate)

public static <T, P> boolean
anySatisfyWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)

public static <T> void
appendString(T[] array, Appendable appendable)

public static <T> void
appendString(T[] array, Appendable appendable, String separator)

public static <T> void
appendString(T[] array, Appendable appendable, String start, String separator, String end)

public static <T> RichIterable<RichIterable<T>>
chunk(T[] array, int size)

public static <T, V> MutableList<V>
collect(T[] objectArray, Function<? super T, ? extends V> function)

public static <T, V, R extends Collection<V>> R
collect(T[] objectArray, Function<? super T, ? extends V> function, R targetCollection)

public static <T> MutableBooleanList
collectBoolean(T[] objectArray, BooleanFunction<? super T> booleanFunction)

public static <T, R extends MutableBooleanCollection> R
collectBoolean(T[] objectArray, BooleanFunction<? super T> booleanFunction, R target)

public static <T> MutableByteList
collectByte(T[] objectArray, ByteFunction<? super T> byteFunction)

public static <T, R extends MutableByteCollection> R
collectByte(T[] objectArray, ByteFunction<? super T> byteFunction, R target)

public static <T> MutableCharList
collectChar(T[] objectArray, CharFunction<? super T> charFunction)

public static <T, R extends MutableCharCollection> R
collectChar(T[] objectArray, CharFunction<? super T> charFunction, R target)

public static <T> MutableDoubleList
collectDouble(T[] objectArray, DoubleFunction<? super T> doubleFunction)

public static <T, R extends MutableDoubleCollection> R
collectDouble(T[] objectArray, DoubleFunction<? super T> doubleFunction, R target)

public static <T> MutableFloatList
collectFloat(T[] objectArray, FloatFunction<? super T> floatFunction)

public static <T, R extends MutableFloatCollection> R
collectFloat(T[] objectArray, FloatFunction<? super T> floatFunction, R target)

public static <T, V> MutableList<V>
collectIf(T[] objectArray, Predicate<? super T> predicate, Function<? super T, ? extends V> function)

public static <T, V, R extends Collection<V>> R
collectIf(T[] objectArray, Predicate<? super T> predicate, Function<? super T, ? extends V> function, R targetCollection)

public static <T> MutableIntList
collectInt(T[] objectArray, IntFunction<? super T> intFunction)

public static <T, R extends MutableIntCollection> R
collectInt(T[] objectArray, IntFunction<? super T> intFunction, R target)

public static <T> MutableLongList
collectLong(T[] objectArray, LongFunction<? super T> longFunction)

public static <T, R extends MutableLongCollection> R
collectLong(T[] objectArray, LongFunction<? super T> longFunction, R target)

public static <T> MutableShortList
collectShort(T[] objectArray, ShortFunction<? super T> shortFunction)

public static <T, R extends MutableShortCollection> R
collectShort(T[] objectArray, ShortFunction<? super T> shortFunction, R target)

public static <T, P, V> MutableList<V>
collectWith(T[] objectArray, Function2<? super T, ? super P, ? extends V> function, P parameter)

public static <T, P, V, R extends Collection<V>> R
collectWith(T[] objectArray, Function2<? super T, ? super P, ? extends V> function, P parameter, R targetCollection)

public static <T> boolean
contains(T[] objectArray, T value)

Returns true if the specified array contains the specified element.

public static boolean
contains(int[] intArray, int value)

Returns true if the specified int array contains the specified int element.

public static boolean
contains(double[] doubleArray, double value)

Returns true if the specified double array contains the specified double element.

public static boolean
contains(long[] longArray, long value)

Returns true if the specified long array contains the specified long element.

public static <T> int
count(T[] objectArray, Predicate<? super T> predicate)

public static <T, P> int
countWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)

public static <T> T
detect(T[] objectArray, Predicate<? super T> predicate)

public static <T> T
detectIfNone(T[] objectArray, Predicate<? super T> predicate, T ifNone)

public static <T> int
detectIndex(T[] objectArray, Predicate<? super T> predicate)

Returns the first index where the predicate evaluates to true.

public static <T, IV> int
detectIndexWith(T[] objectArray, Predicate2<? super T, ? super IV> predicate, IV injectedValue)

Searches for the first index where the predicate evaluates to true.

public static <T> int
detectLastIndex(T[] objectArray, Predicate<? super T> predicate)

Returns the last index where the predicate evaluates to true.

public static <T> Optional<T>
detectOptional(T[] objectArray, Predicate<? super T> predicate)

public static <T, P> T
detectWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)

public static <T, P> T
detectWithIfNone(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter, T ifNone)

public static <T, P> Optional<T>
detectWithOptional(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)

public static <T, R extends List<T>> R
distinct(T[] objectArray, R targetList)
Deprecated in 7.0.

public static <T> MutableList<T>
distinct(T[] objectArray)

public static <T> MutableList<T>
distinct(T[] objectArray, HashingStrategy<? super T> hashingStrategy)

public static <T> MutableList<T>
drop(T[] array, int count)

public static <T, R extends Collection<T>> R
drop(T[] array, int count, R target)

public static <T, V> MutableList<V>
flatCollect(T[] objectArray, Function<? super T, ? extends Iterable<V>> function)

public static <T, V, R extends Collection<V>> R
flatCollect(T[] objectArray, Function<? super T, ? extends Iterable<V>> function, R targetCollection)

public static <T> void
forEach(T[] objectArray, Procedure<? super T> procedure)

public static <T> void
forEach(T[] objectArray, int from, int to, Procedure<? super T> procedure)

Iterates over the section of the list covered by the specified inclusive indexes.

public static <T1, T2> void
forEachInBoth(T1[] objectArray1, T2[] objectArray2, Procedure2<? super T1, ? super T2> procedure)

public static <T, P> void
forEachWith(T[] objectArray, Procedure2<? super T, ? super P> procedure, P parameter)

public static <T> void
forEachWithIndex(T[] objectArray, ObjectIntProcedure<? super T> objectIntProcedure)

public static <T> void
forEachWithIndex(T[] objectArray, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)

Iterates over the section of the list covered by the specified inclusive indexes.

public static <T> T
getFirst(T[] objectArray)

Returns the first element of an array.

public static <T> T
getLast(T[] objectArray)

Returns the last element of an Array.

public static <T, V> FastListMultimap<V, T>
groupBy(T[] array, Function<? super T, ? extends V> function)

public static <T, V, R extends MutableMultimap<V, T>> R
groupBy(T[] array, Function<? super T, ? extends V> function, R target)

public static <T, V> FastListMultimap<V, T>
groupByEach(T[] array, Function<? super T, ? extends Iterable<V>> function)

public static <T, V, R extends MutableMultimap<V, T>> R
groupByEach(T[] array, Function<? super T, ? extends Iterable<V>> function, R target)

public static <T, V> MutableMapIterable<V, T>
groupByUniqueKey(T[] array, Function<? super T, ? extends V> function)

public static <T, V, R extends MutableMapIterable<V, T>> R
groupByUniqueKey(T[] array, Function<? super T, ? extends V> function, R target)

public static <T> int
indexOf(T[] objectArray, T elem)

Searches for the first occurrence of the given argument, testing for equality using the equals method.

public static <T, IV> IV
injectInto(IV injectValue, T[] objectArray, Function2<? super IV, ? super T, ? extends IV> function)

public static <T> int
injectInto(int injectValue, T[] objectArray, IntObjectToIntFunction<? super T> function)

public static <T> long
injectInto(long injectValue, T[] objectArray, LongObjectToLongFunction<? super T> function)

public static <T> float
injectInto(float injectValue, T[] objectArray, FloatObjectToFloatFunction<? super T> function)

public static <T> double
injectInto(double injectValue, T[] objectArray, DoubleObjectToDoubleFunction<? super T> function)

public static <T, IV, P> IV
injectIntoWith(IV injectValue, T[] objectArray, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter)

public static boolean
isEmpty(Object[] array)

A null safe form of isEmpty.

public static <T> String
makeString(T... array)

public static <T> String
makeString(T[] array, String separator)

public static <T> String
makeString(T[] array, String start, String separator, String end)

public static <T> T
max(T[] array, Comparator<? super T> comparator)

public static <T> T
max(T... array)

public static <T, V extends Comparable<? super V>> T
maxBy(T[] array, Function<? super T, ? extends V> function)

public static <T> T
min(T[] array, Comparator<? super T> comparator)

public static <T> T
min(T... array)

public static <T, V extends Comparable<? super V>> T
minBy(T[] array, Function<? super T, ? extends V> function)

public static <T> boolean
noneSatisfy(T[] objectArray, Predicate<? super T> predicate)

public static <T, P> boolean
noneSatisfyWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)

public static boolean
notEmpty(Object[] array)

A null safe form of notEmpty.

public static <T> PartitionFastList<T>
partition(T[] array, Predicate<? super T> predicate)

public static <T, P> PartitionFastList<T>
partitionWith(T[] array, Predicate2<? super T, ? super P> predicate, P parameter)

public static <T> MutableList<T>
reject(T[] objectArray, Predicate<? super T> predicate)

public static <T, R extends Collection<T>> R
reject(T[] objectArray, Predicate<? super T> predicate, R targetCollection)

public static <T, P> MutableList<T>
rejectWith(T[] objectArray, Predicate2<? super T, P> predicate, P parameter)

public static <T, P, R extends Collection<T>> R
rejectWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)

public static <T> void
reverse(T[] array, int size)

public static <T> MutableList<T>
select(T[] objectArray, Predicate<? super T> predicate)

public static <T, R extends Collection<T>> R
select(T[] objectArray, Predicate<? super T> predicate, R targetCollection)

public static <T, P> Twin<MutableList<T>>
selectAndRejectWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter)
Deprecated since 6.0 use RichIterable#partitionWith(Predicate2, Object) instead.

public static <T> FastList<T>
selectInstancesOf(Object[] objectArray, Class<T> clazz)

public static <T, P> MutableList<T>
selectWith(T[] objectArray, Predicate2<? super T, P> predicate, P parameter)

public static <T, P, R extends Collection<T>> R
selectWith(T[] objectArray, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)

public static int
size(Object[] array)

Return the size of the array.

public static <T> void
sort(T[] array, int size, Comparator<? super T> comparator)
Deprecated in 7.0.

Inline calls to appropriate Arrays.sort() method which now uses TimSort by default since Java 8.

public static <V, T> MutableMap<V, BigDecimal>
sumByBigDecimal(T[] array, Function<? super T, ? extends V> groupBy, Function<? super T, BigDecimal> function)

public static <V, T> MutableMap<V, BigInteger>
sumByBigInteger(T[] array, Function<? super T, ? extends V> groupBy, Function<? super T, BigInteger> function)

public static <V, T> ObjectDoubleMap<V>
sumByDouble(T[] array, Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)

public static <V, T> ObjectDoubleMap<V>
sumByFloat(T[] array, Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)

public static <V, T> ObjectLongMap<V>
sumByInt(T[] array, Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)

public static <V, T> ObjectLongMap<V>
sumByLong(T[] array, Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)

public static <T> BigDecimal
sumOfBigDecimal(T[] array, Function<? super T, BigDecimal> function)

public static <T> BigInteger
sumOfBigInteger(T[] array, Function<? super T, BigInteger> function)

public static <T> double
sumOfDouble(T[] array, DoubleFunction<? super T> function)

public static <T> double
sumOfFloat(T[] array, FloatFunction<? super T> function)

public static <T> long
sumOfInt(T[] array, IntFunction<? super T> function)

public static <T> long
sumOfLong(T[] array, LongFunction<? super T> function)

public static <T> MutableList<T>
take(T[] array, int count)

public static <T, R extends Collection<T>> R
take(T[] array, int count, R target)

public static <K, V> MutableMap<K, V>
toMap(V[] objectArray, Function<? super V, ? extends K> keyFunction)

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

public static <T, K, V> MutableMap<K, V>
toMap(T[] objectArray, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)

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

public static <X, Y> MutableList<Pair<X, Y>>
zip(X[] xs, Y[] ys)

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

public static <T> MutableList<Pair<T, Integer>>
zipWithIndex(T... array)

public static <T, R extends Collection<Pair<T, Integer>>> R
zipWithIndex(T[] array, R targetCollection)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait