Class InternalArrayIterate
- java.lang.Object
-
- org.eclipse.collections.impl.utility.internal.InternalArrayIterate
-
public final class InternalArrayIterate extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description private
InternalArrayIterate()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> boolean
allSatisfy(T[] array, int size, Predicate<? super T> predicate)
static <T,P>
booleanallSatisfyWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
static <T> boolean
anySatisfy(T[] array, int size, Predicate<? super T> predicate)
static <T,P>
booleananySatisfyWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
static <T> void
appendString(ListIterable<T> iterable, T[] array, int size, java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
static <T> boolean
arrayEqualsList(T[] array, int size, java.util.List<?> list)
private static <T> void
batchCount(T[] array, int start, int end, CountProcedure<T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.private static <T> void
batchFastListCollect(T[] array, int start, int end, FastListCollectProcedure<T,?> castProcedure)
Implemented to avoid megamorphic call on castProcedure.private static <T> void
batchFastListCollectIf(T[] array, int start, int end, FastListCollectIfProcedure<T,?> castProcedure)
Implemented to avoid megamorphic call on castProcedure.private static <T> void
batchFastListSelect(T[] array, int start, int end, FastListSelectProcedure<T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.static <T> void
batchForEach(Procedure<? super T> procedure, T[] array, int size, int sectionIndex, int sectionCount)
private static <T> void
batchGroupBy(T[] array, int start, int end, MultimapPutProcedure<?,T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.private static <T> void
batchReject(T[] array, int start, int end, FastListRejectProcedure<T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.static <T,V,R extends java.util.Collection<V>>
Rcollect(T[] array, int size, Function<? super T,? extends V> function, R target)
static <T,V,R extends java.util.Collection<V>>
RcollectIf(T[] array, int size, Predicate<? super T> predicate, Function<? super T,? extends V> function, R target)
static <T,P,V,R extends java.util.Collection<V>>
RcollectWith(T[] array, int size, Function2<? super T,? super P,? extends V> function, P parameter, R target)
static <T,V,R extends java.util.Collection<V>>
RcollectWithIndex(T[] array, int size, ObjectIntToObjectFunction<? super T,? extends V> function, R target)
static <T,P>
booleancorresponds(T[] array, int size, OrderedIterable<P> other, Predicate2<? super T,? super P> predicate)
static <T> int
count(T[] array, int size, Predicate<? super T> predicate)
static <T,P>
intcountWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
static <T> T
detect(T[] array, int size, Predicate<? super T> predicate)
static <T> int
detectIndex(T[] objectArray, int size, Predicate<? super T> predicate)
static <T> int
detectLastIndex(T[] objectArray, int size, Predicate<? super T> predicate)
static <T> java.util.Optional<T>
detectOptional(T[] array, int size, Predicate<? super T> predicate)
static <T,P>
TdetectWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
static <T,P>
java.util.Optional<T>detectWithOptional(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
static <T> FastList<T>
distinct(T[] objectArray, int size)
static <T> FastList<T>
distinct(T[] objectArray, int size, HashingStrategy<? super T> hashingStrategy)
static <T,R extends java.util.List<T>>
Rdistinct(T[] objectArray, int size, R targetList)
Deprecated.in 7.0.private static void
ensureCapacityForAdditionalSize(int size, java.util.Collection<?> target)
static <T,V,R extends java.util.Collection<V>>
RflatCollect(T[] array, int size, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
static <T> void
forEachWithIndex(T[] objectArray, int size, ObjectIntProcedure<? super T> objectIntProcedure)
static <T> void
forEachWithIndexWithoutChecks(T[] objectArray, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)
static <T> void
forEachWithoutChecks(T[] objectArray, int from, int to, Procedure<? super T> procedure)
static <T,V,R extends MutableMultimap<V,T>>
RgroupBy(T[] array, int size, Function<? super T,? extends V> function, R target)
static <T,V,R extends MutableMultimap<V,T>>
RgroupByEach(T[] array, int size, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
static <T,K,R extends MutableMapIterable<K,T>>
RgroupByUniqueKey(T[] array, int size, Function<? super T,? extends K> function, R target)
static int
indexOf(java.lang.Object[] array, int size, java.lang.Object object)
static int
lastIndexOf(java.lang.Object[] array, int size, java.lang.Object object)
static <T> T
max(T[] array, int size)
static <T> T
max(T[] array, int size, java.util.Comparator<? super T> comparator)
static <T,V extends java.lang.Comparable<? super V>>
TmaxBy(T[] array, int size, Function<? super T,? extends V> function)
static <T> T
min(T[] array, int size)
static <T> T
min(T[] array, int size, java.util.Comparator<? super T> comparator)
static <T,V extends java.lang.Comparable<? super V>>
TminBy(T[] array, int size, Function<? super T,? extends V> function)
static <T> boolean
noneSatisfy(T[] array, int size, Predicate<? super T> predicate)
static <T,P>
booleannoneSatisfyWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
private static <T> boolean
nonRandomAccessListEquals(T[] array, int size, java.util.List<?> list)
static <T> PartitionFastList<T>
partition(T[] array, int size, Predicate<? super T> predicate)
static <T,P>
PartitionFastList<T>partitionWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
private static <T> boolean
randomAccessListEquals(T[] array, int size, java.util.List<?> list)
static <T> java.util.Optional<T>
reduce(T[] items, int size, java.util.function.BinaryOperator<T> accumulator)
static <R,T>
RreduceInPlace(T[] items, int size, java.util.function.Supplier<R> supplier, java.util.function.BiConsumer<R,? super T> accumulator)
static <R,A,T>
RreduceInPlace(T[] items, int size, java.util.stream.Collector<? super T,A,R> collector)
static <T,R extends java.util.Collection<T>>
Rreject(T[] array, int size, Predicate<? super T> predicate, R target)
static <T,P,R extends java.util.Collection<T>>
RrejectWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter, R target)
static <R extends java.util.Collection<T>,T>
RrejectWithIndex(T[] array, int size, ObjectIntPredicate<? super T> predicate, R target)
Adds all array elements to the target Collection that return false when evaluating the specified predicate which is supplied each element and its relative index.static <T> void
replaceAll(T[] items, int size, java.util.function.UnaryOperator<T> operator)
static <T,R extends java.util.Collection<T>>
Rselect(T[] array, int size, Predicate<? super T> predicate, R target)
static <T,P>
Twin<MutableList<T>>selectAndRejectWith(T[] objectArray, int size, 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[] array, int size, java.lang.Class<T> clazz)
static <T,P,R extends java.util.Collection<T>>
RselectWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
static <R extends java.util.Collection<T>,T>
RselectWithIndex(T[] array, int size, ObjectIntPredicate<? super T> predicate, R target)
Adds all array elements to the target Collection that return true when evaluating the specified predicate which is supplied each element and its relative index.static <T> boolean
shortCircuit(T[] array, int size, Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)
static <T,P>
booleanshortCircuitWith(T[] array, int size, Predicate2<? super T,? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)
static <V,T>
MutableObjectDoubleMap<V>sumByDouble(T[] array, int size, Function<? super T,? extends V> groupBy, DoubleFunction<? super T> function)
static <V,T>
MutableObjectDoubleMap<V>sumByFloat(T[] array, int size, Function<? super T,? extends V> groupBy, FloatFunction<? super T> function)
static <V,T>
MutableObjectLongMap<V>sumByInt(T[] array, int size, Function<? super T,? extends V> groupBy, IntFunction<? super T> function)
static <V,T>
MutableObjectLongMap<V>sumByLong(T[] array, int size, Function<? super T,? extends V> groupBy, LongFunction<? super T> function)
static <T> java.util.DoubleSummaryStatistics
summarizeDouble(T[] items, int size, DoubleFunction<? super T> function)
static <T> java.util.DoubleSummaryStatistics
summarizeFloat(T[] items, int size, FloatFunction<? super T> function)
static <T> java.util.IntSummaryStatistics
summarizeInt(T[] items, int size, IntFunction<? super T> function)
static <T> java.util.LongSummaryStatistics
summarizeLong(T[] items, int size, LongFunction<? super T> function)
static <T> double
sumOfDouble(T[] array, int size, DoubleFunction<? super T> function)
static <T> double
sumOfFloat(T[] array, int size, FloatFunction<? super T> function)
static <T> long
sumOfInt(T[] array, int size, IntFunction<? super T> function)
static <T> long
sumOfLong(T[] array, int size, LongFunction<? super T> function)
-
-
-
Method Detail
-
arrayEqualsList
public static <T> boolean arrayEqualsList(T[] array, int size, java.util.List<?> list)
-
randomAccessListEquals
private static <T> boolean randomAccessListEquals(T[] array, int size, java.util.List<?> list)
-
nonRandomAccessListEquals
private static <T> boolean nonRandomAccessListEquals(T[] array, int size, java.util.List<?> list)
-
forEachWithoutChecks
public static <T> void forEachWithoutChecks(T[] objectArray, int from, int to, Procedure<? super T> procedure)
-
forEachWithIndexWithoutChecks
public static <T> void forEachWithIndexWithoutChecks(T[] objectArray, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)
-
batchForEach
public static <T> void batchForEach(Procedure<? super T> procedure, T[] array, int size, int sectionIndex, int sectionCount)
-
batchGroupBy
private static <T> void batchGroupBy(T[] array, int start, int end, MultimapPutProcedure<?,T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.
-
batchReject
private static <T> void batchReject(T[] array, int start, int end, FastListRejectProcedure<T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.
-
batchCount
private static <T> void batchCount(T[] array, int start, int end, CountProcedure<T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.
-
batchFastListCollectIf
private static <T> void batchFastListCollectIf(T[] array, int start, int end, FastListCollectIfProcedure<T,?> castProcedure)
Implemented to avoid megamorphic call on castProcedure.
-
batchFastListCollect
private static <T> void batchFastListCollect(T[] array, int start, int end, FastListCollectProcedure<T,?> castProcedure)
Implemented to avoid megamorphic call on castProcedure.
-
batchFastListSelect
private static <T> void batchFastListSelect(T[] array, int start, int end, FastListSelectProcedure<T> castProcedure)
Implemented to avoid megamorphic call on castProcedure.
-
groupBy
public static <T,V,R extends MutableMultimap<V,T>> R groupBy(T[] array, int size, Function<? super T,? extends V> function, R target)
-
groupByEach
public static <T,V,R extends MutableMultimap<V,T>> R groupByEach(T[] array, int size, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
-
groupByUniqueKey
public static <T,K,R extends MutableMapIterable<K,T>> R groupByUniqueKey(T[] array, int size, Function<? super T,? extends K> function, R target)
-
partition
public static <T> PartitionFastList<T> partition(T[] array, int size, Predicate<? super T> predicate)
-
partitionWith
public static <T,P> PartitionFastList<T> partitionWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
selectAndRejectWith
@Deprecated public static <T,P> Twin<MutableList<T>> selectAndRejectWith(T[] objectArray, int size, Predicate2<? super T,? super P> predicate, P parameter)
Deprecated.since 6.0 useRichIterable.partitionWith(Predicate2, Object)
instead.
-
indexOf
public static int indexOf(java.lang.Object[] array, int size, java.lang.Object object)
-
lastIndexOf
public static int lastIndexOf(java.lang.Object[] array, int size, java.lang.Object object)
-
select
public static <T,R extends java.util.Collection<T>> R select(T[] array, int size, Predicate<? super T> predicate, R target)
-
selectWith
public static <T,P,R extends java.util.Collection<T>> R selectWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
reject
public static <T,R extends java.util.Collection<T>> R reject(T[] array, int size, Predicate<? super T> predicate, R target)
-
rejectWith
public static <T,P,R extends java.util.Collection<T>> R rejectWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter, R target)
-
selectInstancesOf
public static <T> FastList<T> selectInstancesOf(java.lang.Object[] array, int size, java.lang.Class<T> clazz)
-
collect
public static <T,V,R extends java.util.Collection<V>> R collect(T[] array, int size, Function<? super T,? extends V> function, R target)
-
collectWithIndex
public static <T,V,R extends java.util.Collection<V>> R collectWithIndex(T[] array, int size, ObjectIntToObjectFunction<? super T,? extends V> function, R target)
- Since:
- 9.1.
-
ensureCapacityForAdditionalSize
private static void ensureCapacityForAdditionalSize(int size, java.util.Collection<?> target)
-
flatCollect
public static <T,V,R extends java.util.Collection<V>> R flatCollect(T[] array, int size, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
-
collectWith
public static <T,P,V,R extends java.util.Collection<V>> R collectWith(T[] array, int size, Function2<? super T,? super P,? extends V> function, P parameter, R target)
-
collectIf
public static <T,V,R extends java.util.Collection<V>> R collectIf(T[] array, int size, Predicate<? super T> predicate, Function<? super T,? extends V> function, R target)
-
min
public static <T> T min(T[] array, int size, java.util.Comparator<? super T> comparator)
-
max
public static <T> T max(T[] array, int size, java.util.Comparator<? super T> comparator)
-
min
public static <T> T min(T[] array, int size)
-
max
public static <T> T max(T[] array, int size)
-
minBy
public static <T,V extends java.lang.Comparable<? super V>> T minBy(T[] array, int size, Function<? super T,? extends V> function)
-
maxBy
public static <T,V extends java.lang.Comparable<? super V>> T maxBy(T[] array, int size, Function<? super T,? extends V> function)
-
count
public static <T> int count(T[] array, int size, Predicate<? super T> predicate)
-
countWith
public static <T,P> int countWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
shortCircuit
public static <T> boolean shortCircuit(T[] array, int size, Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)
-
shortCircuitWith
public static <T,P> boolean shortCircuitWith(T[] array, int size, Predicate2<? super T,? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)
-
corresponds
public static <T,P> boolean corresponds(T[] array, int size, OrderedIterable<P> other, Predicate2<? super T,? super P> predicate)
-
anySatisfy
public static <T> boolean anySatisfy(T[] array, int size, Predicate<? super T> predicate)
-
anySatisfyWith
public static <T,P> boolean anySatisfyWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
allSatisfy
public static <T> boolean allSatisfy(T[] array, int size, Predicate<? super T> predicate)
-
allSatisfyWith
public static <T,P> boolean allSatisfyWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
noneSatisfy
public static <T> boolean noneSatisfy(T[] array, int size, Predicate<? super T> predicate)
-
noneSatisfyWith
public static <T,P> boolean noneSatisfyWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
detect
public static <T> T detect(T[] array, int size, Predicate<? super T> predicate)
-
detectWith
public static <T,P> T detectWith(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
detectOptional
public static <T> java.util.Optional<T> detectOptional(T[] array, int size, Predicate<? super T> predicate)
-
detectWithOptional
public static <T,P> java.util.Optional<T> detectWithOptional(T[] array, int size, Predicate2<? super T,? super P> predicate, P parameter)
-
appendString
public static <T> void appendString(ListIterable<T> iterable, T[] array, int size, java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
-
detectIndex
public static <T> int detectIndex(T[] objectArray, int size, Predicate<? super T> predicate)
-
detectLastIndex
public static <T> int detectLastIndex(T[] objectArray, int size, Predicate<? super T> predicate)
-
forEachWithIndex
public static <T> void forEachWithIndex(T[] objectArray, int size, ObjectIntProcedure<? super T> objectIntProcedure)
-
distinct
@Deprecated public static <T,R extends java.util.List<T>> R distinct(T[] objectArray, int size, R targetList)
Deprecated.in 7.0.
-
distinct
public static <T> FastList<T> distinct(T[] objectArray, int size)
- Since:
- 7.0.
-
distinct
public static <T> FastList<T> distinct(T[] objectArray, int size, HashingStrategy<? super T> hashingStrategy)
- Since:
- 7.0.
-
sumOfInt
public static <T> long sumOfInt(T[] array, int size, IntFunction<? super T> function)
-
sumOfLong
public static <T> long sumOfLong(T[] array, int size, LongFunction<? super T> function)
-
sumOfFloat
public static <T> double sumOfFloat(T[] array, int size, FloatFunction<? super T> function)
-
sumOfDouble
public static <T> double sumOfDouble(T[] array, int size, DoubleFunction<? super T> function)
-
sumByInt
public static <V,T> MutableObjectLongMap<V> sumByInt(T[] array, int size, Function<? super T,? extends V> groupBy, IntFunction<? super T> function)
-
sumByLong
public static <V,T> MutableObjectLongMap<V> sumByLong(T[] array, int size, Function<? super T,? extends V> groupBy, LongFunction<? super T> function)
-
sumByFloat
public static <V,T> MutableObjectDoubleMap<V> sumByFloat(T[] array, int size, Function<? super T,? extends V> groupBy, FloatFunction<? super T> function)
-
sumByDouble
public static <V,T> MutableObjectDoubleMap<V> sumByDouble(T[] array, int size, Function<? super T,? extends V> groupBy, DoubleFunction<? super T> function)
-
summarizeInt
public static <T> java.util.IntSummaryStatistics summarizeInt(T[] items, int size, IntFunction<? super T> function)
- Since:
- 8.0
-
summarizeFloat
public static <T> java.util.DoubleSummaryStatistics summarizeFloat(T[] items, int size, FloatFunction<? super T> function)
- Since:
- 8.0
-
summarizeLong
public static <T> java.util.LongSummaryStatistics summarizeLong(T[] items, int size, LongFunction<? super T> function)
- Since:
- 8.0
-
summarizeDouble
public static <T> java.util.DoubleSummaryStatistics summarizeDouble(T[] items, int size, DoubleFunction<? super T> function)
- Since:
- 8.0
-
reduce
public static <T> java.util.Optional<T> reduce(T[] items, int size, java.util.function.BinaryOperator<T> accumulator)
- Since:
- 8.0
-
reduceInPlace
public static <R,A,T> R reduceInPlace(T[] items, int size, java.util.stream.Collector<? super T,A,R> collector)
- Since:
- 8.0
-
reduceInPlace
public static <R,T> R reduceInPlace(T[] items, int size, java.util.function.Supplier<R> supplier, java.util.function.BiConsumer<R,? super T> accumulator)
- Since:
- 8.0
-
replaceAll
public static <T> void replaceAll(T[] items, int size, java.util.function.UnaryOperator<T> operator)
- Since:
- 10.0 - Provided for convenience for array based containers
-
selectWithIndex
public static <R extends java.util.Collection<T>,T> R selectWithIndex(T[] array, int size, ObjectIntPredicate<? super T> predicate, R target)
Adds all array elements to the target Collection that return true when evaluating the specified predicate which is supplied each element and its relative index.- Since:
- 11.0
-
rejectWithIndex
public static <R extends java.util.Collection<T>,T> R rejectWithIndex(T[] array, int size, ObjectIntPredicate<? super T> predicate, R target)
Adds all array elements to the target Collection that return false when evaluating the specified predicate which is supplied each element and its relative index.- Since:
- 11.0
-
-