Class ArrayIterate
- java.lang.Object
-
- org.eclipse.collections.impl.utility.ArrayIterate
-
public final class ArrayIterate extends java.lang.Object
This utility class provides iteration pattern implementations that work with Java arrays.- Since:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ArrayIterate()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T,R extends java.util.Collection<T>>
RaddAllTo(T[] objectArray, R targetCollection)
static <T> boolean
allSatisfy(T[] objectArray, Predicate<? super T> predicate)
static <T,P>
booleanallSatisfyWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
static <T> boolean
anySatisfy(T[] objectArray, Predicate<? super T> predicate)
static <T,P>
booleananySatisfyWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
static <T> void
appendString(T[] array, java.lang.Appendable appendable)
static <T> void
appendString(T[] array, java.lang.Appendable appendable, java.lang.String separator)
static <T> void
appendString(T[] array, java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
static <T> RichIterable<RichIterable<T>>
chunk(T[] array, int size)
static <T,V>
MutableList<V>collect(T[] objectArray, Function<? super T,? extends V> function)
static <T,V,R extends java.util.Collection<V>>
Rcollect(T[] objectArray, Function<? super T,? extends V> function, R targetCollection)
static <T> MutableBooleanList
collectBoolean(T[] objectArray, BooleanFunction<? super T> booleanFunction)
static <T,R extends MutableBooleanCollection>
RcollectBoolean(T[] objectArray, BooleanFunction<? super T> booleanFunction, R target)
static <T> MutableByteList
collectByte(T[] objectArray, ByteFunction<? super T> byteFunction)
static <T,R extends MutableByteCollection>
RcollectByte(T[] objectArray, ByteFunction<? super T> byteFunction, R target)
static <T> MutableCharList
collectChar(T[] objectArray, CharFunction<? super T> charFunction)
static <T,R extends MutableCharCollection>
RcollectChar(T[] objectArray, CharFunction<? super T> charFunction, R target)
static <T> MutableDoubleList
collectDouble(T[] objectArray, DoubleFunction<? super T> doubleFunction)
static <T,R extends MutableDoubleCollection>
RcollectDouble(T[] objectArray, DoubleFunction<? super T> doubleFunction, R target)
static <T> MutableFloatList
collectFloat(T[] objectArray, FloatFunction<? super T> floatFunction)
static <T,R extends MutableFloatCollection>
RcollectFloat(T[] objectArray, FloatFunction<? super T> floatFunction, R target)
static <T,V>
MutableList<V>collectIf(T[] objectArray, Predicate<? super T> predicate, Function<? super T,? extends V> function)
static <T,V,R extends java.util.Collection<V>>
RcollectIf(T[] objectArray, Predicate<? super T> predicate, Function<? super T,? extends V> function, R targetCollection)
static <T> MutableIntList
collectInt(T[] objectArray, IntFunction<? super T> intFunction)
static <T,R extends MutableIntCollection>
RcollectInt(T[] objectArray, IntFunction<? super T> intFunction, R target)
static <T> MutableLongList
collectLong(T[] objectArray, LongFunction<? super T> longFunction)
static <T,R extends MutableLongCollection>
RcollectLong(T[] objectArray, LongFunction<? super T> longFunction, R target)
static <T> MutableShortList
collectShort(T[] objectArray, ShortFunction<? super T> shortFunction)
static <T,R extends MutableShortCollection>
RcollectShort(T[] objectArray, ShortFunction<? super T> shortFunction, R target)
static <T,P,V>
MutableList<V>collectWith(T[] objectArray, Function2<? super T,? super P,? extends V> function, P parameter)
static <T,P,V,R extends java.util.Collection<V>>
RcollectWith(T[] objectArray, Function2<? super T,? super P,? extends V> function, P parameter, R targetCollection)
static boolean
contains(double[] doubleArray, double value)
Returnstrue
if the specified double array contains the specified double element.static boolean
contains(int[] intArray, int value)
Returnstrue
if the specified int array contains the specified int element.static boolean
contains(long[] longArray, long value)
Returnstrue
if the specified long array contains the specified long element.static <T> boolean
contains(T[] objectArray, T value)
Returnstrue
if the specified array contains the specified element.static <T> int
count(T[] objectArray, Predicate<? super T> predicate)
static <T,P>
intcountWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
static <T> T
detect(T[] objectArray, Predicate<? super T> predicate)
static <T> T
detectIfNone(T[] objectArray, Predicate<? super T> predicate, T ifNone)
static <T> int
detectIndex(T[] objectArray, Predicate<? super T> predicate)
Returns the first index where the predicate evaluates totrue
.static <T,IV>
intdetectIndexWith(T[] objectArray, Predicate2<? super T,? super IV> predicate, IV injectedValue)
Searches for the first index where the predicate evaluates totrue
.static <T> int
detectLastIndex(T[] objectArray, Predicate<? super T> predicate)
Returns the last index where the predicate evaluates totrue
.static <T> java.util.Optional<T>
detectOptional(T[] objectArray, Predicate<? super T> predicate)
static <T,P>
TdetectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
static <T,P>
TdetectWithIfNone(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter, T ifNone)
static <T,P>
java.util.Optional<T>detectWithOptional(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
static <T> MutableList<T>
distinct(T[] objectArray)
static <T> MutableList<T>
distinct(T[] objectArray, HashingStrategy<? super T> hashingStrategy)
static <T,R extends java.util.List<T>>
Rdistinct(T[] objectArray, R targetList)
Deprecated.in 7.0.static <T> MutableList<T>
drop(T[] array, int count)
static <T,R extends java.util.Collection<T>>
Rdrop(T[] array, int count, R target)
static <T,V>
MutableList<V>flatCollect(T[] objectArray, Function<? super T,? extends java.lang.Iterable<V>> function)
static <T,V,R extends java.util.Collection<V>>
RflatCollect(T[] objectArray, Function<? super T,? extends java.lang.Iterable<V>> function, R targetCollection)
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.static <T> void
forEach(T[] objectArray, Procedure<? super T> procedure)
static <T1,T2>
voidforEachInBoth(T1[] objectArray1, T2[] objectArray2, Procedure2<? super T1,? super T2> procedure)
static <T,P>
voidforEachWith(T[] objectArray, Procedure2<? super T,? super P> procedure, P parameter)
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.static <T> void
forEachWithIndex(T[] objectArray, ObjectIntProcedure<? super T> objectIntProcedure)
static <T> T
getFirst(T[] objectArray)
Returns the first element of an array.static <T> T
getLast(T[] objectArray)
Returns the last element of an Array.static <T,V>
FastListMultimap<V,T>groupBy(T[] array, Function<? super T,? extends V> function)
static <T,V,R extends MutableMultimap<V,T>>
RgroupBy(T[] array, Function<? super T,? extends V> function, R target)
static <T,V>
FastListMultimap<V,T>groupByEach(T[] array, Function<? super T,? extends java.lang.Iterable<V>> function)
static <T,V,R extends MutableMultimap<V,T>>
RgroupByEach(T[] array, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
static <T,V>
MutableMapIterable<V,T>groupByUniqueKey(T[] array, Function<? super T,? extends V> function)
static <T,V,R extends MutableMapIterable<V,T>>
RgroupByUniqueKey(T[] array, Function<? super T,? extends V> function, R target)
static <T> int
indexOf(T[] objectArray, T elem)
Searches for the first occurrence of the given argument, testing for equality using theequals
method.static <T> double
injectInto(double injectValue, T[] objectArray, DoubleObjectToDoubleFunction<? super T> function)
static <T> float
injectInto(float injectValue, T[] objectArray, FloatObjectToFloatFunction<? super T> function)
static <T> int
injectInto(int injectValue, T[] objectArray, IntObjectToIntFunction<? super T> function)
static <T> long
injectInto(long injectValue, T[] objectArray, LongObjectToLongFunction<? super T> function)
static <T,IV>
IVinjectInto(IV injectValue, T[] objectArray, Function2<? super IV,? super T,? extends IV> function)
static <T,IV,P>
IVinjectIntoWith(IV injectValue, T[] objectArray, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)
static boolean
isEmpty(java.lang.Object[] array)
A null safe form of isEmpty.static <T> java.lang.String
makeString(T... array)
static <T> java.lang.String
makeString(T[] array, java.lang.String separator)
static <T> java.lang.String
makeString(T[] array, java.lang.String start, java.lang.String separator, java.lang.String end)
static <T> T
max(T... array)
static <T> T
max(T[] array, java.util.Comparator<? super T> comparator)
static <T,V extends java.lang.Comparable<? super V>>
TmaxBy(T[] array, Function<? super T,? extends V> function)
static <T> T
min(T... array)
static <T> T
min(T[] array, java.util.Comparator<? super T> comparator)
static <T,V extends java.lang.Comparable<? super V>>
TminBy(T[] array, Function<? super T,? extends V> function)
static <T> boolean
noneSatisfy(T[] objectArray, Predicate<? super T> predicate)
static <T,P>
booleannoneSatisfyWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
static boolean
notEmpty(java.lang.Object[] array)
A null safe form of notEmpty.static <T> PartitionFastList<T>
partition(T[] array, Predicate<? super T> predicate)
static <T,P>
PartitionFastList<T>partitionWith(T[] array, Predicate2<? super T,? super P> predicate, P parameter)
static <T> MutableList<T>
reject(T[] objectArray, Predicate<? super T> predicate)
static <T,R extends java.util.Collection<T>>
Rreject(T[] objectArray, Predicate<? super T> predicate, R targetCollection)
static <T,P,R extends java.util.Collection<T>>
RrejectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
static <T,P>
MutableList<T>rejectWith(T[] objectArray, Predicate2<? super T,P> predicate, P parameter)
static <T> void
reverse(T[] array, int size)
static <T> MutableList<T>
select(T[] objectArray, Predicate<? super T> predicate)
static <T,R extends java.util.Collection<T>>
Rselect(T[] objectArray, Predicate<? super T> predicate, R targetCollection)
static <T,P>
Twin<MutableList<T>>selectAndRejectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
Deprecated.since 6.0 useRichIterable.partitionWith(Predicate2, Object)
instead.static <T> FastList<T>
selectInstancesOf(java.lang.Object[] objectArray, java.lang.Class<T> clazz)
static <T,P,R extends java.util.Collection<T>>
RselectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
static <T,P>
MutableList<T>selectWith(T[] objectArray, Predicate2<? super T,P> predicate, P parameter)
static int
size(java.lang.Object[] array)
Return the size of the array.static <T> void
sort(T[] array, int size, java.util.Comparator<? super T> comparator)
Deprecated.in 7.0.static <V,T>
MutableMap<V,java.math.BigDecimal>sumByBigDecimal(T[] array, Function<? super T,? extends V> groupBy, Function<? super T,java.math.BigDecimal> function)
static <V,T>
MutableMap<V,java.math.BigInteger>sumByBigInteger(T[] array, Function<? super T,? extends V> groupBy, Function<? super T,java.math.BigInteger> function)
static <V,T>
ObjectDoubleMap<V>sumByDouble(T[] array, Function<? super T,? extends V> groupBy, DoubleFunction<? super T> function)
static <V,T>
ObjectDoubleMap<V>sumByFloat(T[] array, Function<? super T,? extends V> groupBy, FloatFunction<? super T> function)
static <V,T>
ObjectLongMap<V>sumByInt(T[] array, Function<? super T,? extends V> groupBy, IntFunction<? super T> function)
static <V,T>
ObjectLongMap<V>sumByLong(T[] array, Function<? super T,? extends V> groupBy, LongFunction<? super T> function)
static <T> java.math.BigDecimal
sumOfBigDecimal(T[] array, Function<? super T,java.math.BigDecimal> function)
static <T> java.math.BigInteger
sumOfBigInteger(T[] array, Function<? super T,java.math.BigInteger> function)
static <T> double
sumOfDouble(T[] array, DoubleFunction<? super T> function)
static <T> double
sumOfFloat(T[] array, FloatFunction<? super T> function)
static <T> long
sumOfInt(T[] array, IntFunction<? super T> function)
static <T> long
sumOfLong(T[] array, LongFunction<? super T> function)
static <T> MutableList<T>
take(T[] array, int count)
static <T,R extends java.util.Collection<T>>
Rtake(T[] array, int count, R target)
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.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.static <X,Y>
MutableList<Pair<X,Y>>zip(X[] xs, Y[] ys)
static <X,Y,R extends java.util.Collection<Pair<X,Y>>>
Rzip(X[] xs, Y[] ys, R targetCollection)
static <T> MutableList<Pair<T,java.lang.Integer>>
zipWithIndex(T... array)
static <T,R extends java.util.Collection<Pair<T,java.lang.Integer>>>
RzipWithIndex(T[] array, R targetCollection)
-
-
-
Method Detail
-
reverse
public static <T> void reverse(T[] array, int size)
-
sort
@Deprecated public static <T> void sort(T[] array, int size, java.util.Comparator<? super T> comparator)
Deprecated.in 7.0. UseArrays.sort(Object[], int, int)
orArrays.sort(Object[], int, int, Comparator)
instead.Inline calls to appropriate Arrays.sort() method which now uses TimSort by default since Java 8.
-
minBy
public static <T,V extends java.lang.Comparable<? super V>> T minBy(T[] array, Function<? super T,? extends V> function)
-
maxBy
public static <T,V extends java.lang.Comparable<? super V>> T maxBy(T[] array, Function<? super T,? extends V> function)
-
min
public static <T> T min(T[] array, java.util.Comparator<? super T> comparator)
- See Also:
Iterate.min(Iterable, Comparator)
-
max
public static <T> T max(T[] array, java.util.Comparator<? super T> comparator)
- See Also:
Iterate.max(Iterable, Comparator)
-
min
public static <T> T min(T... array)
- See Also:
Iterate.min(Iterable)
-
max
public static <T> T max(T... array)
- See Also:
Iterate.max(Iterable)
-
select
public static <T> MutableList<T> select(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.select(Iterable, Predicate)
-
selectWith
public static <T,P> MutableList<T> selectWith(T[] objectArray, Predicate2<? super T,P> predicate, P parameter)
-
selectInstancesOf
public static <T> FastList<T> selectInstancesOf(java.lang.Object[] objectArray, java.lang.Class<T> clazz)
-
count
public static <T> int count(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.count(Iterable, Predicate)
-
countWith
public static <T,P> int countWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
-
selectAndRejectWith
@Deprecated public static <T,P> Twin<MutableList<T>> selectAndRejectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
Deprecated.since 6.0 useRichIterable.partitionWith(Predicate2, Object)
instead.
-
partition
public static <T> PartitionFastList<T> partition(T[] array, Predicate<? super T> predicate)
- See Also:
Iterate.partition(Iterable, Predicate)
-
partitionWith
public static <T,P> PartitionFastList<T> partitionWith(T[] array, Predicate2<? super T,? super P> predicate, P parameter)
-
collectIf
public static <T,V> MutableList<V> collectIf(T[] objectArray, Predicate<? super T> predicate, Function<? super T,? extends V> function)
-
select
public static <T,R extends java.util.Collection<T>> R select(T[] objectArray, Predicate<? super T> predicate, R targetCollection)
-
selectWith
public static <T,P,R extends java.util.Collection<T>> R selectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
collectIf
public static <T,V,R extends java.util.Collection<V>> R collectIf(T[] objectArray, Predicate<? super T> predicate, Function<? super T,? extends V> function, R targetCollection)
-
reject
public static <T> MutableList<T> reject(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.reject(Iterable, Predicate)
-
rejectWith
public static <T,P> MutableList<T> rejectWith(T[] objectArray, Predicate2<? super T,P> predicate, P parameter)
-
reject
public static <T,R extends java.util.Collection<T>> R reject(T[] objectArray, Predicate<? super T> predicate, R targetCollection)
-
rejectWith
public static <T,P,R extends java.util.Collection<T>> R rejectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
addAllTo
public static <T,R extends java.util.Collection<T>> R addAllTo(T[] objectArray, R targetCollection)
- See Also:
Iterate.addAllTo(Iterable, Collection)
-
collect
public static <T,V> MutableList<V> collect(T[] objectArray, Function<? super T,? extends V> function)
- See Also:
Iterate.collect(Iterable, Function)
-
collect
public static <T,V,R extends java.util.Collection<V>> R collect(T[] objectArray, Function<? super T,? extends V> function, R targetCollection)
-
collectBoolean
public static <T> MutableBooleanList collectBoolean(T[] objectArray, BooleanFunction<? super T> booleanFunction)
-
collectBoolean
public static <T,R extends MutableBooleanCollection> R collectBoolean(T[] objectArray, BooleanFunction<? super T> booleanFunction, R target)
-
collectByte
public static <T> MutableByteList collectByte(T[] objectArray, ByteFunction<? super T> byteFunction)
-
collectByte
public static <T,R extends MutableByteCollection> R collectByte(T[] objectArray, ByteFunction<? super T> byteFunction, R target)
-
collectChar
public static <T> MutableCharList collectChar(T[] objectArray, CharFunction<? super T> charFunction)
-
collectChar
public static <T,R extends MutableCharCollection> R collectChar(T[] objectArray, CharFunction<? super T> charFunction, R target)
-
collectDouble
public static <T> MutableDoubleList collectDouble(T[] objectArray, DoubleFunction<? super T> doubleFunction)
-
collectDouble
public static <T,R extends MutableDoubleCollection> R collectDouble(T[] objectArray, DoubleFunction<? super T> doubleFunction, R target)
-
collectFloat
public static <T> MutableFloatList collectFloat(T[] objectArray, FloatFunction<? super T> floatFunction)
-
collectFloat
public static <T,R extends MutableFloatCollection> R collectFloat(T[] objectArray, FloatFunction<? super T> floatFunction, R target)
-
collectInt
public static <T> MutableIntList collectInt(T[] objectArray, IntFunction<? super T> intFunction)
-
collectInt
public static <T,R extends MutableIntCollection> R collectInt(T[] objectArray, IntFunction<? super T> intFunction, R target)
-
collectLong
public static <T> MutableLongList collectLong(T[] objectArray, LongFunction<? super T> longFunction)
-
collectLong
public static <T,R extends MutableLongCollection> R collectLong(T[] objectArray, LongFunction<? super T> longFunction, R target)
-
collectShort
public static <T> MutableShortList collectShort(T[] objectArray, ShortFunction<? super T> shortFunction)
-
collectShort
public static <T,R extends MutableShortCollection> R collectShort(T[] objectArray, ShortFunction<? super T> shortFunction, R target)
-
flatCollect
public static <T,V> MutableList<V> flatCollect(T[] objectArray, Function<? super T,? extends java.lang.Iterable<V>> function)
- See Also:
Iterate.flatCollect(Iterable, Function)
-
flatCollect
public static <T,V,R extends java.util.Collection<V>> R flatCollect(T[] objectArray, Function<? super T,? extends java.lang.Iterable<V>> function, R targetCollection)
-
getFirst
public static <T> T getFirst(T[] objectArray)
Returns the first element of an array. This method is null safe.
-
getLast
public static <T> T getLast(T[] objectArray)
Returns the last element of an Array. This method is null safe.
-
forEach
public static <T> void forEach(T[] objectArray, Procedure<? super T> procedure)
- See Also:
Iterate.forEach(Iterable, Procedure)
-
forEach
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. The indexes are both inclusive.
-
forEachInBoth
public static <T1,T2> void forEachInBoth(T1[] objectArray1, T2[] objectArray2, Procedure2<? super T1,? super T2> procedure)
-
forEachWithIndex
public static <T> void forEachWithIndex(T[] objectArray, ObjectIntProcedure<? super T> objectIntProcedure)
-
forEachWithIndex
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. The indexes are both inclusive.
-
detect
public static <T> T detect(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.detect(Iterable, Predicate)
-
detectWith
public static <T,P> T detectWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
-
detectOptional
public static <T> java.util.Optional<T> detectOptional(T[] objectArray, Predicate<? super T> predicate)
-
detectWithOptional
public static <T,P> java.util.Optional<T> detectWithOptional(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
-
detectIfNone
public static <T> T detectIfNone(T[] objectArray, Predicate<? super T> predicate, T ifNone)
-
detectWithIfNone
public static <T,P> T detectWithIfNone(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter, T ifNone)
-
injectInto
public static <T,IV> IV injectInto(IV injectValue, T[] objectArray, Function2<? super IV,? super T,? extends IV> function)
-
injectInto
public static <T> int injectInto(int injectValue, T[] objectArray, IntObjectToIntFunction<? super T> function)
-
injectInto
public static <T> long injectInto(long injectValue, T[] objectArray, LongObjectToLongFunction<? super T> function)
-
injectInto
public static <T> float injectInto(float injectValue, T[] objectArray, FloatObjectToFloatFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.injectInto(float, Iterable, FloatObjectToFloatFunction)
-
injectInto
public static <T> double injectInto(double injectValue, T[] objectArray, DoubleObjectToDoubleFunction<? super T> function)
-
distinct
@Deprecated public static <T,R extends java.util.List<T>> R distinct(T[] objectArray, R targetList)
Deprecated.in 7.0.
-
distinct
public static <T> MutableList<T> distinct(T[] objectArray)
- Since:
- 7.0.
-
distinct
public static <T> MutableList<T> distinct(T[] objectArray, HashingStrategy<? super T> hashingStrategy)
- Since:
- 7.0.
-
contains
public static <T> boolean contains(T[] objectArray, T value)
Returnstrue
if the specified array contains the specified element.
-
contains
public static boolean contains(int[] intArray, int value)
Returnstrue
if the specified int array contains the specified int element.
-
contains
public static boolean contains(double[] doubleArray, double value)
Returnstrue
if the specified double array contains the specified double element.
-
contains
public static boolean contains(long[] longArray, long value)
Returnstrue
if the specified long array contains the specified long element.
-
indexOf
public static <T> int indexOf(T[] objectArray, T elem)
Searches for the first occurrence of the given argument, testing for equality using theequals
method.
-
detectIndex
public static <T> int detectIndex(T[] objectArray, Predicate<? super T> predicate)
Returns the first index where the predicate evaluates totrue
. Returns -1 for no matches.
-
detectIndexWith
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 totrue
. Returns -1 for no matches.
-
detectLastIndex
public static <T> int detectLastIndex(T[] objectArray, Predicate<? super T> predicate)
Returns the last index where the predicate evaluates totrue
. Returns -1 for no matches.
-
isEmpty
public static boolean isEmpty(java.lang.Object[] array)
A null safe form of isEmpty. Null or length of zero returnstrue
.
-
notEmpty
public static boolean notEmpty(java.lang.Object[] array)
A null safe form of notEmpty. The opposite of isEmpty is returned.
-
size
public static int size(java.lang.Object[] array)
Return the size of the array.
-
anySatisfy
public static <T> boolean anySatisfy(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.anySatisfy(Iterable, Predicate)
-
anySatisfyWith
public static <T,P> boolean anySatisfyWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
-
allSatisfy
public static <T> boolean allSatisfy(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.allSatisfy(Iterable, Predicate)
-
allSatisfyWith
public static <T,P> boolean allSatisfyWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
-
noneSatisfy
public static <T> boolean noneSatisfy(T[] objectArray, Predicate<? super T> predicate)
- See Also:
Iterate.noneSatisfy(Iterable, Predicate)
-
noneSatisfyWith
public static <T,P> boolean noneSatisfyWith(T[] objectArray, Predicate2<? super T,? super P> predicate, P parameter)
-
toMap
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.
-
toMap
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.
-
forEachWith
public static <T,P> void forEachWith(T[] objectArray, Procedure2<? super T,? super P> procedure, P parameter)
-
collectWith
public static <T,P,V> MutableList<V> collectWith(T[] objectArray, Function2<? super T,? super P,? extends V> function, P parameter)
-
collectWith
public static <T,P,V,R extends java.util.Collection<V>> R collectWith(T[] objectArray, Function2<? super T,? super P,? extends V> function, P parameter, R targetCollection)
-
injectIntoWith
public static <T,IV,P> IV injectIntoWith(IV injectValue, T[] objectArray, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)
-
take
public static <T> MutableList<T> take(T[] array, int count)
- See Also:
Iterate.take(Iterable, int)
-
take
public static <T,R extends java.util.Collection<T>> R take(T[] array, int count, R target)
- See Also:
Iterate.take(Iterable, int)
-
drop
public static <T> MutableList<T> drop(T[] array, int count)
- See Also:
Iterate.drop(Iterable, int)
-
drop
public static <T,R extends java.util.Collection<T>> R drop(T[] array, int count, R target)
- See Also:
Iterate.drop(Iterable, int)
-
groupBy
public static <T,V> FastListMultimap<V,T> groupBy(T[] array, Function<? super T,? extends V> function)
- See Also:
Iterate.groupBy(Iterable, Function)
-
groupBy
public static <T,V,R extends MutableMultimap<V,T>> R groupBy(T[] array, Function<? super T,? extends V> function, R target)
-
groupByEach
public static <T,V> FastListMultimap<V,T> groupByEach(T[] array, Function<? super T,? extends java.lang.Iterable<V>> function)
- See Also:
Iterate.groupByEach(Iterable, Function)
-
groupByEach
public static <T,V,R extends MutableMultimap<V,T>> R groupByEach(T[] array, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
-
groupByUniqueKey
public static <T,V> MutableMapIterable<V,T> groupByUniqueKey(T[] array, Function<? super T,? extends V> function)
-
groupByUniqueKey
public static <T,V,R extends MutableMapIterable<V,T>> R groupByUniqueKey(T[] array, Function<? super T,? extends V> function, R target)
-
chunk
public static <T> RichIterable<RichIterable<T>> chunk(T[] array, int size)
- See Also:
Iterate.chunk(Iterable, int)
-
zip
public static <X,Y> MutableList<Pair<X,Y>> zip(X[] xs, Y[] ys)
- See Also:
Iterate.zip(Iterable, Iterable)
-
zip
public static <X,Y,R extends java.util.Collection<Pair<X,Y>>> R zip(X[] xs, Y[] ys, R targetCollection)
-
zipWithIndex
public static <T> MutableList<Pair<T,java.lang.Integer>> zipWithIndex(T... array)
- See Also:
Iterate.zipWithIndex(Iterable)
-
zipWithIndex
public static <T,R extends java.util.Collection<Pair<T,java.lang.Integer>>> R zipWithIndex(T[] array, R targetCollection)
-
makeString
public static <T> java.lang.String makeString(T... array)
- See Also:
Iterate.makeString(Iterable)
-
makeString
public static <T> java.lang.String makeString(T[] array, java.lang.String separator)
- See Also:
Iterate.makeString(Iterable, String)
-
makeString
public static <T> java.lang.String makeString(T[] array, java.lang.String start, java.lang.String separator, java.lang.String end)
-
appendString
public static <T> void appendString(T[] array, java.lang.Appendable appendable)
-
appendString
public static <T> void appendString(T[] array, java.lang.Appendable appendable, java.lang.String separator)
-
appendString
public static <T> void appendString(T[] array, java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
-
sumOfInt
public static <T> long sumOfInt(T[] array, IntFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumOfInt(Iterable, IntFunction)
-
sumOfLong
public static <T> long sumOfLong(T[] array, LongFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumOfLong(Iterable, LongFunction)
-
sumOfFloat
public static <T> double sumOfFloat(T[] array, FloatFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumOfFloat(Iterable, FloatFunction)
-
sumOfDouble
public static <T> double sumOfDouble(T[] array, DoubleFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumOfDouble(Iterable, DoubleFunction)
-
sumOfBigDecimal
public static <T> java.math.BigDecimal sumOfBigDecimal(T[] array, Function<? super T,java.math.BigDecimal> function)
- Since:
- 6.0
- See Also:
Iterate.sumOfBigDecimal(Iterable, Function)
-
sumOfBigInteger
public static <T> java.math.BigInteger sumOfBigInteger(T[] array, Function<? super T,java.math.BigInteger> function)
- Since:
- 6.0
- See Also:
Iterate.sumOfBigInteger(Iterable, Function)
-
sumByBigDecimal
public static <V,T> MutableMap<V,java.math.BigDecimal> sumByBigDecimal(T[] array, Function<? super T,? extends V> groupBy, Function<? super T,java.math.BigDecimal> function)
- Since:
- 6.0
- See Also:
Iterate.sumByBigDecimal(Iterable, Function, Function)
-
sumByBigInteger
public static <V,T> MutableMap<V,java.math.BigInteger> sumByBigInteger(T[] array, Function<? super T,? extends V> groupBy, Function<? super T,java.math.BigInteger> function)
- Since:
- 6.0
- See Also:
Iterate.sumByBigInteger(Iterable, Function, Function)
-
sumByInt
public static <V,T> ObjectLongMap<V> sumByInt(T[] array, Function<? super T,? extends V> groupBy, IntFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumByInt(Iterable, Function, IntFunction)
-
sumByLong
public static <V,T> ObjectLongMap<V> sumByLong(T[] array, Function<? super T,? extends V> groupBy, LongFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumByLong(Iterable, Function, LongFunction)
-
sumByFloat
public static <V,T> ObjectDoubleMap<V> sumByFloat(T[] array, Function<? super T,? extends V> groupBy, FloatFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumByFloat(Iterable, Function, FloatFunction)
-
sumByDouble
public static <V,T> ObjectDoubleMap<V> sumByDouble(T[] array, Function<? super T,? extends V> groupBy, DoubleFunction<? super T> function)
- Since:
- 6.0
- See Also:
Iterate.sumByDouble(Iterable, Function, DoubleFunction)
-
-