Class ListIterate
- java.lang.Object
-
- org.eclipse.collections.impl.utility.ListIterate
-
public final class ListIterate extends java.lang.Object
The ListIterate utility class can be useful for iterating over lists, especially if there is a desire to return a MutableList from any of the iteration methods.- Since:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ListIterate()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> boolean
allSatisfy(java.util.List<T> list, Predicate<? super T> predicate)
static <T,IV>
booleanallSatisfyWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T> boolean
anySatisfy(java.util.List<T> list, Predicate<? super T> predicate)
static <T,IV>
booleananySatisfyWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T> void
appendString(java.util.List<T> list, java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
static <T> RichIterable<RichIterable<T>>
chunk(java.util.List<T> list, int size)
static <T,A>
MutableList<A>collect(java.util.List<T> list, Function<? super T,? extends A> function)
static <T,A,R extends java.util.Collection<A>>
Rcollect(java.util.List<T> list, Function<? super T,? extends A> function, R targetCollection)
static <T> MutableBooleanList
collectBoolean(java.util.List<T> list, BooleanFunction<? super T> booleanFunction)
static <T,R extends MutableBooleanCollection>
RcollectBoolean(java.util.List<T> list, BooleanFunction<? super T> booleanFunction, R target)
static <T> MutableByteList
collectByte(java.util.List<T> list, ByteFunction<? super T> byteFunction)
static <T,R extends MutableByteCollection>
RcollectByte(java.util.List<T> list, ByteFunction<? super T> byteFunction, R target)
static <T> MutableCharList
collectChar(java.util.List<T> list, CharFunction<? super T> charFunction)
static <T,R extends MutableCharCollection>
RcollectChar(java.util.List<T> list, CharFunction<? super T> charFunction, R target)
static <T> MutableDoubleList
collectDouble(java.util.List<T> list, DoubleFunction<? super T> doubleFunction)
static <T,R extends MutableDoubleCollection>
RcollectDouble(java.util.List<T> list, DoubleFunction<? super T> doubleFunction, R target)
static <T> MutableFloatList
collectFloat(java.util.List<T> list, FloatFunction<? super T> floatFunction)
static <T,R extends MutableFloatCollection>
RcollectFloat(java.util.List<T> list, FloatFunction<? super T> floatFunction, R target)
static <T,A>
MutableList<A>collectIf(java.util.List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function)
static <T,A,R extends java.util.Collection<A>>
RcollectIf(java.util.List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function, R targetCollection)
static <T> MutableIntList
collectInt(java.util.List<T> list, IntFunction<? super T> intFunction)
static <T,R extends MutableIntCollection>
RcollectInt(java.util.List<T> list, IntFunction<? super T> intFunction, R target)
static <T> MutableLongList
collectLong(java.util.List<T> list, LongFunction<? super T> longFunction)
static <T,R extends MutableLongCollection>
RcollectLong(java.util.List<T> list, LongFunction<? super T> longFunction, R target)
static <T> MutableShortList
collectShort(java.util.List<T> list, ShortFunction<? super T> shortFunction)
static <T,R extends MutableShortCollection>
RcollectShort(java.util.List<T> list, ShortFunction<? super T> shortFunction, R target)
static <T,P,A>
MutableList<A>collectWith(java.util.List<T> list, Function2<? super T,? super P,? extends A> function, P parameter)
static <T,P,A,R extends java.util.Collection<A>>
RcollectWith(java.util.List<T> list, Function2<? super T,? super P,? extends A> function, P parameter, R targetCollection)
static <T,A>
MutableList<A>collectWithIndex(java.util.List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function)
static <T,A,R extends java.util.Collection<A>>
RcollectWithIndex(java.util.List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function, R targetCollection)
static <T> int
count(java.util.List<T> list, Predicate<? super T> predicate)
static <T,IV>
intcountWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T> T
detect(java.util.List<T> list, Predicate<? super T> predicate)
static <T> T
detectIfNone(java.util.List<T> list, Predicate<? super T> predicate, T ifNone)
static <T> int
detectIndex(java.util.List<T> list, Predicate<? super T> predicate)
Searches for the first index where the predicate evaluates to true.static <T,P>
intdetectIndexWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
Searches for the first index where the predicate2 and parameter evaluates to true.static <T> int
detectLastIndex(java.util.List<T> list, Predicate<? super T> predicate)
Returns the last index where the predicate evaluates to true.static <T> java.util.Optional<T>
detectOptional(java.util.List<T> list, Predicate<? super T> predicate)
static <T,IV>
TdetectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T,IV>
TdetectWithIfNone(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue, T ifNone)
static <T,IV>
java.util.Optional<T>detectWithOptional(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T> MutableList<T>
distinct(java.util.List<T> list)
static <T> MutableList<T>
distinct(java.util.List<T> list, HashingStrategy<? super T> hashingStrategy)
static <T,R extends java.util.List<T>>
Rdistinct(java.util.List<T> list, R targetList)
Deprecated.in 7.0.static <T,V>
MutableList<T>distinctBy(java.util.List<T> list, Function<? super T,? extends V> function)
static <T> MutableList<T>
drop(java.util.List<T> list, int count)
static <T,R extends java.util.Collection<T>>
Rdrop(java.util.List<T> list, int count, R targetList)
static <T> MutableList<T>
dropWhile(java.util.List<T> list, Predicate<? super T> predicate)
static boolean
equals(java.util.List<?> one, java.util.List<?> two)
static <T,A>
MutableList<A>flatCollect(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<A>> function)
static <T,A,R extends java.util.Collection<A>>
RflatCollect(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<A>> function, R targetCollection)
static <T> void
forEach(java.util.List<T> list, int from, int to, Procedure<? super T> procedure)
Iterates over the section of the list covered by the specified indexes.static <T> void
forEach(java.util.List<T> list, Procedure<? super T> procedure)
static <T1,T2>
voidforEachInBoth(java.util.List<T1> list1, java.util.List<T2> list2, Procedure2<? super T1,? super T2> procedure)
Iterates over both lists together, evaluating Procedure2 with the current element from each list.static <T,P>
voidforEachWith(java.util.List<T> list, Procedure2<? super T,? super P> procedure, P parameter)
static <T> void
forEachWithIndex(java.util.List<T> list, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)
Iterates over the section of the list covered by the specified indexes.static <T> void
forEachWithIndex(java.util.List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
static <T> T
getFirst(java.util.List<T> collection)
Returns the first element of a list.static <T> T
getLast(java.util.List<T> list)
Returns the last element of a list.static <T,V>
FastListMultimap<V,T>groupBy(java.util.List<T> list, Function<? super T,? extends V> function)
static <T,V,R extends MutableMultimap<V,T>>
RgroupBy(java.util.List<T> list, Function<? super T,? extends V> function, R target)
static <T,V>
FastListMultimap<V,T>groupByEach(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<V>> function)
static <T,V,R extends MutableMultimap<V,T>>
RgroupByEach(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
static <K,T>
MutableMap<K,T>groupByUniqueKey(java.util.List<T> list, Function<? super T,? extends K> function)
static <K,T,R extends MutableMapIterable<K,T>>
RgroupByUniqueKey(java.util.List<T> list, Function<? super T,? extends K> function, R target)
static <T> double
injectInto(double injectValue, java.util.List<T> list, DoubleObjectToDoubleFunction<? super T> function)
static <T> float
injectInto(float injectValue, java.util.List<T> list, FloatObjectToFloatFunction<? super T> function)
static <T> int
injectInto(int injectValue, java.util.List<T> list, IntObjectToIntFunction<? super T> function)
static <T> long
injectInto(long injectValue, java.util.List<T> list, LongObjectToLongFunction<? super T> function)
static <T,IV>
IVinjectInto(IV injectValue, java.util.List<T> list, Function2<? super IV,? super T,? extends IV> function)
static <T,IV,P>
IVinjectIntoWith(IV injectedValue, java.util.List<T> list, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)
static <T> T
max(java.util.List<T> list)
static <T> T
max(java.util.List<T> list, java.util.Comparator<? super T> comparator)
static <T,V extends java.lang.Comparable<? super V>>
TmaxBy(java.util.List<T> list, Function<? super T,? extends V> function)
static <T> T
min(java.util.List<T> list)
static <T> T
min(java.util.List<T> list, java.util.Comparator<? super T> comparator)
static <T,V extends java.lang.Comparable<? super V>>
TminBy(java.util.List<T> list, Function<? super T,? extends V> function)
static <T> boolean
noneSatisfy(java.util.List<T> list, Predicate<? super T> predicate)
static <T,P>
booleannoneSatisfyWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P injectedValue)
private static boolean
nonRandomAccessEquals(java.util.List<?> one, java.util.List<?> two)
private static boolean
oneRandomAccessEquals(java.util.List<?> one, java.util.List<?> two)
static <T> PartitionMutableList<T>
partition(java.util.List<T> list, Predicate<? super T> predicate)
static <T> PartitionMutableList<T>
partitionWhile(java.util.List<T> list, Predicate<? super T> predicate)
static <T,P>
PartitionMutableList<T>partitionWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
private static boolean
randomAccessEquals(java.util.List<?> one, java.util.List<?> two)
static void
rangeCheck(int from, int to, int size)
static <T> MutableList<T>
reject(java.util.List<T> list, Predicate<? super T> predicate)
static <T,R extends java.util.Collection<T>>
Rreject(java.util.List<T> list, Predicate<? super T> predicate, R targetCollection)
static <T,IV>
MutableList<T>rejectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T,P,R extends java.util.Collection<T>>
RrejectWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
static <T> boolean
removeIf(java.util.List<T> list, Predicate<? super T> predicate)
static <T> boolean
removeIf(java.util.List<T> list, Predicate<? super T> predicate, Procedure<? super T> procedure)
static <T,P>
booleanremoveIfWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
static <T,P>
booleanremoveIfWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter, Procedure<? super T> procedure)
static <T> void
reverseForEach(java.util.List<T> list, Procedure<? super T> procedure)
Iterates over the List in reverse order executing the Procedure for each elementstatic <T> void
reverseForEachWithIndex(java.util.List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
Iterates over the List in reverse order executing the Procedure for each element.static <T> java.util.List<T>
reverseThis(java.util.List<T> list)
Reverses the order of the items in the list.static <T> MutableList<T>
select(java.util.List<T> list, Predicate<? super T> predicate)
static <T,R extends java.util.Collection<T>>
Rselect(java.util.List<T> list, Predicate<? super T> predicate, R targetCollection)
static <T,IV>
Twin<MutableList<T>>selectAndRejectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T,S>
MutableList<S>selectInstancesOf(java.util.List<T> list, java.lang.Class<S> clazz)
static <T,IV>
MutableList<T>selectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
static <T,P,R extends java.util.Collection<T>>
RselectWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
static <V,T>
MutableMap<V,java.math.BigDecimal>sumByBigDecimal(java.util.List<T> list, Function<T,V> groupBy, Function<? super T,java.math.BigDecimal> function)
static <V,T>
MutableMap<V,java.math.BigInteger>sumByBigInteger(java.util.List<T> list, Function<T,V> groupBy, Function<? super T,java.math.BigInteger> function)
static <V,T>
ObjectDoubleMap<V>sumByDouble(java.util.List<T> list, Function<T,V> groupBy, DoubleFunction<? super T> function)
static <V,T>
ObjectDoubleMap<V>sumByFloat(java.util.List<T> list, Function<T,V> groupBy, FloatFunction<? super T> function)
static <V,T>
ObjectLongMap<V>sumByInt(java.util.List<T> list, Function<T,V> groupBy, IntFunction<? super T> function)
static <V,T>
ObjectLongMap<V>sumByLong(java.util.List<T> list, Function<T,V> groupBy, LongFunction<? super T> function)
static <T> java.math.BigDecimal
sumOfBigDecimal(java.util.List<T> list, Function<? super T,java.math.BigDecimal> function)
static <T> java.math.BigInteger
sumOfBigInteger(java.util.List<T> list, Function<? super T,java.math.BigInteger> function)
static <T> double
sumOfDouble(java.util.List<T> list, DoubleFunction<? super T> function)
static <T> double
sumOfFloat(java.util.List<T> list, FloatFunction<? super T> function)
static <T> long
sumOfInt(java.util.List<T> list, IntFunction<? super T> function)
static <T> long
sumOfLong(java.util.List<T> list, LongFunction<? super T> function)
static <T> MutableList<T>
take(java.util.List<T> list, int count)
static <T,R extends java.util.Collection<T>>
Rtake(java.util.List<T> list, int count, R targetList)
static <T> MutableList<T>
takeWhile(java.util.List<T> list, Predicate<? super T> predicate)
static <T> void
toArray(java.util.List<T> list, T[] target, int startIndex, int sourceSize)
static <X,Y>
MutableList<Pair<X,Y>>zip(java.util.List<X> list, java.lang.Iterable<Y> iterable)
static <X,Y,R extends java.util.Collection<Pair<X,Y>>>
Rzip(java.util.List<X> list, java.lang.Iterable<Y> iterable, R target)
static <T> MutableList<Pair<T,java.lang.Integer>>
zipWithIndex(java.util.List<T> list)
static <T,R extends java.util.Collection<Pair<T,java.lang.Integer>>>
RzipWithIndex(java.util.List<T> list, R target)
-
-
-
Method Detail
-
equals
public static boolean equals(java.util.List<?> one, java.util.List<?> two)
-
randomAccessEquals
private static boolean randomAccessEquals(java.util.List<?> one, java.util.List<?> two)
-
oneRandomAccessEquals
private static boolean oneRandomAccessEquals(java.util.List<?> one, java.util.List<?> two)
-
nonRandomAccessEquals
private static boolean nonRandomAccessEquals(java.util.List<?> one, java.util.List<?> two)
-
toArray
public static <T> void toArray(java.util.List<T> list, T[] target, int startIndex, int sourceSize)
-
select
public static <T> MutableList<T> select(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.select(Iterable, Predicate)
-
selectWith
public static <T,IV> MutableList<T> selectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
select
public static <T,R extends java.util.Collection<T>> R select(java.util.List<T> list, Predicate<? super T> predicate, R targetCollection)
-
selectWith
public static <T,P,R extends java.util.Collection<T>> R selectWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
selectInstancesOf
public static <T,S> MutableList<S> selectInstancesOf(java.util.List<T> list, java.lang.Class<S> clazz)
-
count
public static <T> int count(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.count(Iterable, Predicate)
-
countWith
public static <T,IV> int countWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
collectIf
public static <T,A> MutableList<A> collectIf(java.util.List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function)
-
collectIf
public static <T,A,R extends java.util.Collection<A>> R collectIf(java.util.List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function, R targetCollection)
-
reject
public static <T> MutableList<T> reject(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.reject(Iterable, Predicate)
-
rejectWith
public static <T,IV> MutableList<T> rejectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
reject
public static <T,R extends java.util.Collection<T>> R reject(java.util.List<T> list, Predicate<? super T> predicate, R targetCollection)
-
rejectWith
public static <T,P,R extends java.util.Collection<T>> R rejectWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
collect
public static <T,A> MutableList<A> collect(java.util.List<T> list, Function<? super T,? extends A> function)
- See Also:
Iterate.collect(Iterable, Function)
-
collect
public static <T,A,R extends java.util.Collection<A>> R collect(java.util.List<T> list, Function<? super T,? extends A> function, R targetCollection)
-
collectWithIndex
public static <T,A> MutableList<A> collectWithIndex(java.util.List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function)
- Since:
- 9.1
-
collectWithIndex
public static <T,A,R extends java.util.Collection<A>> R collectWithIndex(java.util.List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function, R targetCollection)
- Since:
- 9.1
-
collectBoolean
public static <T> MutableBooleanList collectBoolean(java.util.List<T> list, BooleanFunction<? super T> booleanFunction)
-
collectBoolean
public static <T,R extends MutableBooleanCollection> R collectBoolean(java.util.List<T> list, BooleanFunction<? super T> booleanFunction, R target)
-
collectByte
public static <T> MutableByteList collectByte(java.util.List<T> list, ByteFunction<? super T> byteFunction)
-
collectByte
public static <T,R extends MutableByteCollection> R collectByte(java.util.List<T> list, ByteFunction<? super T> byteFunction, R target)
-
collectChar
public static <T> MutableCharList collectChar(java.util.List<T> list, CharFunction<? super T> charFunction)
-
collectChar
public static <T,R extends MutableCharCollection> R collectChar(java.util.List<T> list, CharFunction<? super T> charFunction, R target)
-
collectDouble
public static <T> MutableDoubleList collectDouble(java.util.List<T> list, DoubleFunction<? super T> doubleFunction)
-
collectDouble
public static <T,R extends MutableDoubleCollection> R collectDouble(java.util.List<T> list, DoubleFunction<? super T> doubleFunction, R target)
-
collectFloat
public static <T> MutableFloatList collectFloat(java.util.List<T> list, FloatFunction<? super T> floatFunction)
-
collectFloat
public static <T,R extends MutableFloatCollection> R collectFloat(java.util.List<T> list, FloatFunction<? super T> floatFunction, R target)
-
collectInt
public static <T> MutableIntList collectInt(java.util.List<T> list, IntFunction<? super T> intFunction)
-
collectInt
public static <T,R extends MutableIntCollection> R collectInt(java.util.List<T> list, IntFunction<? super T> intFunction, R target)
-
collectLong
public static <T> MutableLongList collectLong(java.util.List<T> list, LongFunction<? super T> longFunction)
-
collectLong
public static <T,R extends MutableLongCollection> R collectLong(java.util.List<T> list, LongFunction<? super T> longFunction, R target)
-
collectShort
public static <T> MutableShortList collectShort(java.util.List<T> list, ShortFunction<? super T> shortFunction)
-
collectShort
public static <T,R extends MutableShortCollection> R collectShort(java.util.List<T> list, ShortFunction<? super T> shortFunction, R target)
-
flatCollect
public static <T,A> MutableList<A> flatCollect(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<A>> function)
- See Also:
Iterate.flatCollect(Iterable, Function)
-
flatCollect
public static <T,A,R extends java.util.Collection<A>> R flatCollect(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<A>> function, R targetCollection)
-
getFirst
public static <T> T getFirst(java.util.List<T> collection)
Returns the first element of a list.
-
getLast
public static <T> T getLast(java.util.List<T> list)
Returns the last element of a list.
-
forEach
public static <T> void forEach(java.util.List<T> list, Procedure<? super T> procedure)
- See Also:
Iterate.forEach(Iterable, Procedure)
-
reverseForEach
public static <T> void reverseForEach(java.util.List<T> list, Procedure<? super T> procedure)
Iterates over the List in reverse order executing the Procedure for each element
-
reverseForEachWithIndex
public static <T> void reverseForEachWithIndex(java.util.List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
Iterates over the List in reverse order executing the Procedure for each element. The index passed into the ObjectIntProcedure is the actual index of the range.
-
forEach
public static <T> void forEach(java.util.List<T> list, int from, int to, Procedure<? super T> procedure)
Iterates over the section of the list covered by the specified indexes. The indexes are both inclusive. If the from is less than the to, the list is iterated in forward order. If the from is greater than the to, then the list is iterated in the reverse order.e.g. MutableList<People> people = FastList.newListWith(ted, mary, bob, sally); ListIterate.forEach(people, 0, 1, new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
This code would output ted and mary's names.
-
forEachWithIndex
public static <T> void forEachWithIndex(java.util.List<T> list, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)
Iterates over the section of the list covered by the specified indexes. The indexes are both inclusive. If the from is less than the to, the list is iterated in forward order. If the from is greater than the to, then the list is iterated in the reverse order. The index passed into the ObjectIntProcedure is the actual index of the range.e.g. MutableList<People> people = FastList.newListWith(ted, mary, bob, sally); ListIterate.forEachWithIndex(people, 0, 1, new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info(person.getName() + " at index: " + index); } });
This code would output ted and mary's names.
-
rangeCheck
public static void rangeCheck(int from, int to, int size)
-
forEachInBoth
public static <T1,T2> void forEachInBoth(java.util.List<T1> list1, java.util.List<T2> list2, Procedure2<? super T1,? super T2> procedure)
Iterates over both lists together, evaluating Procedure2 with the current element from each list.
-
forEachWithIndex
public static <T> void forEachWithIndex(java.util.List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
-
detect
public static <T> T detect(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.detect(Iterable, Predicate)
-
detectWith
public static <T,IV> T detectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
detectOptional
public static <T> java.util.Optional<T> detectOptional(java.util.List<T> list, Predicate<? super T> predicate)
-
detectWithOptional
public static <T,IV> java.util.Optional<T> detectWithOptional(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
detectIfNone
public static <T> T detectIfNone(java.util.List<T> list, Predicate<? super T> predicate, T ifNone)
-
detectWithIfNone
public static <T,IV> T detectWithIfNone(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue, T ifNone)
-
injectInto
public static <T,IV> IV injectInto(IV injectValue, java.util.List<T> list, Function2<? super IV,? super T,? extends IV> function)
-
injectInto
public static <T> int injectInto(int injectValue, java.util.List<T> list, IntObjectToIntFunction<? super T> function)
-
injectInto
public static <T> long injectInto(long injectValue, java.util.List<T> list, LongObjectToLongFunction<? super T> function)
-
injectInto
public static <T> double injectInto(double injectValue, java.util.List<T> list, DoubleObjectToDoubleFunction<? super T> function)
-
injectInto
public static <T> float injectInto(float injectValue, java.util.List<T> list, FloatObjectToFloatFunction<? super T> function)
-
sumOfInt
public static <T> long sumOfInt(java.util.List<T> list, IntFunction<? super T> function)
-
sumOfLong
public static <T> long sumOfLong(java.util.List<T> list, LongFunction<? super T> function)
-
sumOfFloat
public static <T> double sumOfFloat(java.util.List<T> list, FloatFunction<? super T> function)
-
sumOfDouble
public static <T> double sumOfDouble(java.util.List<T> list, DoubleFunction<? super T> function)
-
sumOfBigDecimal
public static <T> java.math.BigDecimal sumOfBigDecimal(java.util.List<T> list, Function<? super T,java.math.BigDecimal> function)
-
sumOfBigInteger
public static <T> java.math.BigInteger sumOfBigInteger(java.util.List<T> list, Function<? super T,java.math.BigInteger> function)
-
sumByBigDecimal
public static <V,T> MutableMap<V,java.math.BigDecimal> sumByBigDecimal(java.util.List<T> list, Function<T,V> groupBy, Function<? super T,java.math.BigDecimal> function)
-
sumByBigInteger
public static <V,T> MutableMap<V,java.math.BigInteger> sumByBigInteger(java.util.List<T> list, Function<T,V> groupBy, Function<? super T,java.math.BigInteger> function)
-
sumByInt
public static <V,T> ObjectLongMap<V> sumByInt(java.util.List<T> list, Function<T,V> groupBy, IntFunction<? super T> function)
-
sumByLong
public static <V,T> ObjectLongMap<V> sumByLong(java.util.List<T> list, Function<T,V> groupBy, LongFunction<? super T> function)
-
sumByFloat
public static <V,T> ObjectDoubleMap<V> sumByFloat(java.util.List<T> list, Function<T,V> groupBy, FloatFunction<? super T> function)
-
sumByDouble
public static <V,T> ObjectDoubleMap<V> sumByDouble(java.util.List<T> list, Function<T,V> groupBy, DoubleFunction<? super T> function)
-
anySatisfy
public static <T> boolean anySatisfy(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.anySatisfy(Iterable, Predicate)
-
anySatisfyWith
public static <T,IV> boolean anySatisfyWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
allSatisfy
public static <T> boolean allSatisfy(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.allSatisfy(Iterable, Predicate)
-
allSatisfyWith
public static <T,IV> boolean allSatisfyWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
noneSatisfy
public static <T> boolean noneSatisfy(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.noneSatisfy(Iterable, Predicate)
-
noneSatisfyWith
public static <T,P> boolean noneSatisfyWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P injectedValue)
-
selectAndRejectWith
public static <T,IV> Twin<MutableList<T>> selectAndRejectWith(java.util.List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
partition
public static <T> PartitionMutableList<T> partition(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.partition(Iterable, Predicate)
-
partitionWith
public static <T,P> PartitionMutableList<T> partitionWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
-
removeIf
public static <T> boolean removeIf(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.removeIf(Iterable, Predicate)
-
removeIfWith
public static <T,P> boolean removeIfWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
-
removeIf
public static <T> boolean removeIf(java.util.List<T> list, Predicate<? super T> predicate, Procedure<? super T> procedure)
-
removeIfWith
public static <T,P> boolean removeIfWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter, Procedure<? super T> procedure)
-
detectIndex
public static <T> int detectIndex(java.util.List<T> list, Predicate<? super T> predicate)
Searches for the first index where the predicate evaluates to true.
-
detectIndexWith
public static <T,P> int detectIndexWith(java.util.List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
Searches for the first index where the predicate2 and parameter evaluates to true.
-
detectLastIndex
public static <T> int detectLastIndex(java.util.List<T> list, Predicate<? super T> predicate)
Returns the last index where the predicate evaluates to true. Returns -1 for no matches.
-
injectIntoWith
public static <T,IV,P> IV injectIntoWith(IV injectedValue, java.util.List<T> list, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)
-
forEachWith
public static <T,P> void forEachWith(java.util.List<T> list, Procedure2<? super T,? super P> procedure, P parameter)
-
collectWith
public static <T,P,A> MutableList<A> collectWith(java.util.List<T> list, Function2<? super T,? super P,? extends A> function, P parameter)
-
collectWith
public static <T,P,A,R extends java.util.Collection<A>> R collectWith(java.util.List<T> list, Function2<? super T,? super P,? extends A> function, P parameter, R targetCollection)
-
distinct
@Deprecated public static <T,R extends java.util.List<T>> R distinct(java.util.List<T> list, R targetList)
Deprecated.in 7.0.
-
distinct
public static <T> MutableList<T> distinct(java.util.List<T> list)
- Since:
- 7.0.
-
distinct
public static <T> MutableList<T> distinct(java.util.List<T> list, HashingStrategy<? super T> hashingStrategy)
- Since:
- 7.0.
-
distinctBy
public static <T,V> MutableList<T> distinctBy(java.util.List<T> list, Function<? super T,? extends V> function)
- Since:
- 9.0
-
reverseThis
public static <T> java.util.List<T> reverseThis(java.util.List<T> list)
Reverses the order of the items in the list.List<Integer> integers = Lists.fixedSize.of(1, 3, 2); Verify.assertListsEqual(FastList.newListWith(2, 3, 1), ListIterate.reverse(integers));
- Returns:
- the reversed list
-
take
public static <T> MutableList<T> take(java.util.List<T> list, int count)
- See Also:
Iterate.take(Iterable, int)
-
take
public static <T,R extends java.util.Collection<T>> R take(java.util.List<T> list, int count, R targetList)
- See Also:
Iterate.take(Iterable, int)
-
drop
public static <T> MutableList<T> drop(java.util.List<T> list, int count)
- See Also:
Iterate.drop(Iterable, int)
-
drop
public static <T,R extends java.util.Collection<T>> R drop(java.util.List<T> list, int count, R targetList)
- See Also:
Iterate.drop(Iterable, int)
-
appendString
public static <T> void appendString(java.util.List<T> list, java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
-
groupBy
public static <T,V> FastListMultimap<V,T> groupBy(java.util.List<T> list, Function<? super T,? extends V> function)
- See Also:
Iterate.groupBy(Iterable, Function)
-
groupBy
public static <T,V,R extends MutableMultimap<V,T>> R groupBy(java.util.List<T> list, Function<? super T,? extends V> function, R target)
-
groupByEach
public static <T,V> FastListMultimap<V,T> groupByEach(java.util.List<T> list, 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(java.util.List<T> list, Function<? super T,? extends java.lang.Iterable<V>> function, R target)
-
groupByUniqueKey
public static <K,T> MutableMap<K,T> groupByUniqueKey(java.util.List<T> list, Function<? super T,? extends K> function)
-
groupByUniqueKey
public static <K,T,R extends MutableMapIterable<K,T>> R groupByUniqueKey(java.util.List<T> list, Function<? super T,? extends K> function, R target)
-
min
public static <T> T min(java.util.List<T> list, java.util.Comparator<? super T> comparator)
- See Also:
Iterate.min(Iterable, Comparator)
-
minBy
public static <T,V extends java.lang.Comparable<? super V>> T minBy(java.util.List<T> list, Function<? super T,? extends V> function)
-
maxBy
public static <T,V extends java.lang.Comparable<? super V>> T maxBy(java.util.List<T> list, Function<? super T,? extends V> function)
-
max
public static <T> T max(java.util.List<T> list, java.util.Comparator<? super T> comparator)
- See Also:
Iterate.max(Iterable, Comparator)
-
min
public static <T> T min(java.util.List<T> list)
- See Also:
Iterate.min(Iterable)
-
max
public static <T> T max(java.util.List<T> list)
- See Also:
Iterate.max(Iterable)
-
chunk
public static <T> RichIterable<RichIterable<T>> chunk(java.util.List<T> list, int size)
- See Also:
Iterate.chunk(Iterable, int)
-
zip
public static <X,Y> MutableList<Pair<X,Y>> zip(java.util.List<X> list, java.lang.Iterable<Y> iterable)
- See Also:
Iterate.zip(Iterable, Iterable)
-
zip
public static <X,Y,R extends java.util.Collection<Pair<X,Y>>> R zip(java.util.List<X> list, java.lang.Iterable<Y> iterable, R target)
-
zipWithIndex
public static <T> MutableList<Pair<T,java.lang.Integer>> zipWithIndex(java.util.List<T> list)
- See Also:
Iterate.zipWithIndex(Iterable)
-
zipWithIndex
public static <T,R extends java.util.Collection<Pair<T,java.lang.Integer>>> R zipWithIndex(java.util.List<T> list, R target)
-
takeWhile
public static <T> MutableList<T> takeWhile(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
ListIterable.takeWhile(Predicate)
-
dropWhile
public static <T> MutableList<T> dropWhile(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
ListIterable.dropWhile(Predicate)
-
partitionWhile
public static <T> PartitionMutableList<T> partitionWhile(java.util.List<T> list, Predicate<? super T> predicate)
- See Also:
ListIterable.partitionWhile(Predicate)
-
-