Class ListIterate
- java.lang.Object
-
- org.eclipse.collections.impl.utility.ListIterate
-
public final class ListIterate extends 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
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> booleanallSatisfy(List<T> list, Predicate<? super T> predicate)static <T,IV>
booleanallSatisfyWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T> booleananySatisfy(List<T> list, Predicate<? super T> predicate)static <T,IV>
booleananySatisfyWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T> voidappendString(List<T> list, Appendable appendable, String start, String separator, String end)static <T> RichIterable<RichIterable<T>>chunk(List<T> list, int size)static <T,A>
MutableList<A>collect(List<T> list, Function<? super T,? extends A> function)static <T,A,R extends Collection<A>>
Rcollect(List<T> list, Function<? super T,? extends A> function, R targetCollection)static <T> MutableBooleanListcollectBoolean(List<T> list, BooleanFunction<? super T> booleanFunction)static <T,R extends MutableBooleanCollection>
RcollectBoolean(List<T> list, BooleanFunction<? super T> booleanFunction, R target)static <T> MutableByteListcollectByte(List<T> list, ByteFunction<? super T> byteFunction)static <T,R extends MutableByteCollection>
RcollectByte(List<T> list, ByteFunction<? super T> byteFunction, R target)static <T> MutableCharListcollectChar(List<T> list, CharFunction<? super T> charFunction)static <T,R extends MutableCharCollection>
RcollectChar(List<T> list, CharFunction<? super T> charFunction, R target)static <T> MutableDoubleListcollectDouble(List<T> list, DoubleFunction<? super T> doubleFunction)static <T,R extends MutableDoubleCollection>
RcollectDouble(List<T> list, DoubleFunction<? super T> doubleFunction, R target)static <T> MutableFloatListcollectFloat(List<T> list, FloatFunction<? super T> floatFunction)static <T,R extends MutableFloatCollection>
RcollectFloat(List<T> list, FloatFunction<? super T> floatFunction, R target)static <T,A>
MutableList<A>collectIf(List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function)static <T,A,R extends Collection<A>>
RcollectIf(List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function, R targetCollection)static <T> MutableIntListcollectInt(List<T> list, IntFunction<? super T> intFunction)static <T,R extends MutableIntCollection>
RcollectInt(List<T> list, IntFunction<? super T> intFunction, R target)static <T> MutableLongListcollectLong(List<T> list, LongFunction<? super T> longFunction)static <T,R extends MutableLongCollection>
RcollectLong(List<T> list, LongFunction<? super T> longFunction, R target)static <T> MutableShortListcollectShort(List<T> list, ShortFunction<? super T> shortFunction)static <T,R extends MutableShortCollection>
RcollectShort(List<T> list, ShortFunction<? super T> shortFunction, R target)static <T,P,A>
MutableList<A>collectWith(List<T> list, Function2<? super T,? super P,? extends A> function, P parameter)static <T,P,A,R extends Collection<A>>
RcollectWith(List<T> list, Function2<? super T,? super P,? extends A> function, P parameter, R targetCollection)static <T,A>
MutableList<A>collectWithIndex(List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function)static <T,A,R extends Collection<A>>
RcollectWithIndex(List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function, R targetCollection)static <T> intcount(List<T> list, Predicate<? super T> predicate)static <T,IV>
intcountWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T> Tdetect(List<T> list, Predicate<? super T> predicate)static <T> TdetectIfNone(List<T> list, Predicate<? super T> predicate, T ifNone)static <T> intdetectIndex(List<T> list, Predicate<? super T> predicate)Searches for the first index where the predicate evaluates to true.static <T,P>
intdetectIndexWith(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> intdetectLastIndex(List<T> list, Predicate<? super T> predicate)Returns the last index where the predicate evaluates to true.static <T> Optional<T>detectOptional(List<T> list, Predicate<? super T> predicate)static <T,IV>
TdetectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T,IV>
TdetectWithIfNone(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue, T ifNone)static <T,IV>
Optional<T>detectWithOptional(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T> MutableList<T>distinct(List<T> list)static <T> MutableList<T>distinct(List<T> list, HashingStrategy<? super T> hashingStrategy)static <T,R extends List<T>>
Rdistinct(List<T> list, R targetList)Deprecated.in 7.0.static <T,V>
MutableList<T>distinctBy(List<T> list, Function<? super T,? extends V> function)static <T> MutableList<T>drop(List<T> list, int count)static <T,R extends Collection<T>>
Rdrop(List<T> list, int count, R targetList)static <T> MutableList<T>dropWhile(List<T> list, Predicate<? super T> predicate)static booleanequals(List<?> one, List<?> two)static <T,A>
MutableList<A>flatCollect(List<T> list, Function<? super T,? extends Iterable<A>> function)static <T,A,R extends Collection<A>>
RflatCollect(List<T> list, Function<? super T,? extends Iterable<A>> function, R targetCollection)static <T> voidforEach(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> voidforEach(List<T> list, Procedure<? super T> procedure)static <T1,T2>
voidforEachInBoth(List<T1> list1, 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(List<T> list, Procedure2<? super T,? super P> procedure, P parameter)static <T> voidforEachWithIndex(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> voidforEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)static <T> TgetFirst(List<T> collection)Returns the first element of a list.static <T> TgetLast(List<T> list)Returns the last element of a list.static <T,V>
FastListMultimap<V,T>groupBy(List<T> list, Function<? super T,? extends V> function)static <T,V,R extends MutableMultimap<V,T>>
RgroupBy(List<T> list, Function<? super T,? extends V> function, R target)static <T,V>
FastListMultimap<V,T>groupByEach(List<T> list, Function<? super T,? extends Iterable<V>> function)static <T,V,R extends MutableMultimap<V,T>>
RgroupByEach(List<T> list, Function<? super T,? extends Iterable<V>> function, R target)static <K,T>
MutableMap<K,T>groupByUniqueKey(List<T> list, Function<? super T,? extends K> function)static <K,T,R extends MutableMapIterable<K,T>>
RgroupByUniqueKey(List<T> list, Function<? super T,? extends K> function, R target)static <T> doubleinjectInto(double injectValue, List<T> list, DoubleObjectToDoubleFunction<? super T> function)static <T> floatinjectInto(float injectValue, List<T> list, FloatObjectToFloatFunction<? super T> function)static <T> intinjectInto(int injectValue, List<T> list, IntObjectToIntFunction<? super T> function)static <T> longinjectInto(long injectValue, List<T> list, LongObjectToLongFunction<? super T> function)static <T,IV>
IVinjectInto(IV injectValue, List<T> list, Function2<? super IV,? super T,? extends IV> function)static <T,IV,P>
IVinjectIntoWith(IV injectedValue, List<T> list, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)static <T> Tmax(List<T> list)static <T> Tmax(List<T> list, Comparator<? super T> comparator)static <T,V extends Comparable<? super V>>
TmaxBy(List<T> list, Function<? super T,? extends V> function)static <T> Tmin(List<T> list)static <T> Tmin(List<T> list, Comparator<? super T> comparator)static <T,V extends Comparable<? super V>>
TminBy(List<T> list, Function<? super T,? extends V> function)static <T> booleannoneSatisfy(List<T> list, Predicate<? super T> predicate)static <T,P>
booleannoneSatisfyWith(List<T> list, Predicate2<? super T,? super P> predicate, P injectedValue)static <T> PartitionMutableList<T>partition(List<T> list, Predicate<? super T> predicate)static <T> PartitionMutableList<T>partitionWhile(List<T> list, Predicate<? super T> predicate)static <T,P>
PartitionMutableList<T>partitionWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter)static voidrangeCheck(int from, int to, int size)static <T> MutableList<T>reject(List<T> list, Predicate<? super T> predicate)static <T,R extends Collection<T>>
Rreject(List<T> list, Predicate<? super T> predicate, R targetCollection)static <T,IV>
MutableList<T>rejectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T,P,R extends Collection<T>>
RrejectWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)static <T> booleanremoveIf(List<T> list, Predicate<? super T> predicate)static <T> booleanremoveIf(List<T> list, Predicate<? super T> predicate, Procedure<? super T> procedure)static <T,P>
booleanremoveIfWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter)static <T,P>
booleanremoveIfWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter, Procedure<? super T> procedure)static <T> voidreverseForEach(List<T> list, Procedure<? super T> procedure)Iterates over the List in reverse order executing the Procedure for each elementstatic <T> voidreverseForEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)Iterates over the List in reverse order executing the Procedure for each element.static <T> List<T>reverseThis(List<T> list)Reverses the order of the items in the list.static <T> MutableList<T>select(List<T> list, Predicate<? super T> predicate)static <T,R extends Collection<T>>
Rselect(List<T> list, Predicate<? super T> predicate, R targetCollection)static <T,IV>
Twin<MutableList<T>>selectAndRejectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T,S>
MutableList<S>selectInstancesOf(List<T> list, Class<S> clazz)static <T,IV>
MutableList<T>selectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)static <T,P,R extends Collection<T>>
RselectWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)static <V,T>
MutableMap<V,BigDecimal>sumByBigDecimal(List<T> list, Function<T,V> groupBy, Function<? super T,BigDecimal> function)static <V,T>
MutableMap<V,BigInteger>sumByBigInteger(List<T> list, Function<T,V> groupBy, Function<? super T,BigInteger> function)static <V,T>
ObjectDoubleMap<V>sumByDouble(List<T> list, Function<T,V> groupBy, DoubleFunction<? super T> function)static <V,T>
ObjectDoubleMap<V>sumByFloat(List<T> list, Function<T,V> groupBy, FloatFunction<? super T> function)static <V,T>
ObjectLongMap<V>sumByInt(List<T> list, Function<T,V> groupBy, IntFunction<? super T> function)static <V,T>
ObjectLongMap<V>sumByLong(List<T> list, Function<T,V> groupBy, LongFunction<? super T> function)static <T> BigDecimalsumOfBigDecimal(List<T> list, Function<? super T,BigDecimal> function)static <T> BigIntegersumOfBigInteger(List<T> list, Function<? super T,BigInteger> function)static <T> doublesumOfDouble(List<T> list, DoubleFunction<? super T> function)static <T> doublesumOfFloat(List<T> list, FloatFunction<? super T> function)static <T> longsumOfInt(List<T> list, IntFunction<? super T> function)static <T> longsumOfLong(List<T> list, LongFunction<? super T> function)static <T> MutableList<T>take(List<T> list, int count)static <T,R extends Collection<T>>
Rtake(List<T> list, int count, R targetList)static <T> MutableList<T>takeWhile(List<T> list, Predicate<? super T> predicate)static <T> voidtoArray(List<T> list, T[] target, int startIndex, int sourceSize)static <X,Y>
MutableList<Pair<X,Y>>zip(List<X> list, Iterable<Y> iterable)static <X,Y,R extends Collection<Pair<X,Y>>>
Rzip(List<X> list, Iterable<Y> iterable, R target)static <T> MutableList<Pair<T,Integer>>zipWithIndex(List<T> list)static <T,R extends Collection<Pair<T,Integer>>>
RzipWithIndex(List<T> list, R target)
-
-
-
Method Detail
-
toArray
public static <T> void toArray(List<T> list, T[] target, int startIndex, int sourceSize)
-
select
public static <T> MutableList<T> select(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.select(Iterable, Predicate)
-
selectWith
public static <T,IV> MutableList<T> selectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
select
public static <T,R extends Collection<T>> R select(List<T> list, Predicate<? super T> predicate, R targetCollection)
-
selectWith
public static <T,P,R extends Collection<T>> R selectWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
selectInstancesOf
public static <T,S> MutableList<S> selectInstancesOf(List<T> list, Class<S> clazz)
-
count
public static <T> int count(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.count(Iterable, Predicate)
-
countWith
public static <T,IV> int countWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
collectIf
public static <T,A> MutableList<A> collectIf(List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function)
-
collectIf
public static <T,A,R extends Collection<A>> R collectIf(List<T> list, Predicate<? super T> predicate, Function<? super T,? extends A> function, R targetCollection)
-
reject
public static <T> MutableList<T> reject(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.reject(Iterable, Predicate)
-
rejectWith
public static <T,IV> MutableList<T> rejectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
reject
public static <T,R extends Collection<T>> R reject(List<T> list, Predicate<? super T> predicate, R targetCollection)
-
rejectWith
public static <T,P,R extends Collection<T>> R rejectWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)
-
collect
public static <T,A> MutableList<A> collect(List<T> list, Function<? super T,? extends A> function)
- See Also:
Iterate.collect(Iterable, Function)
-
collect
public static <T,A,R extends Collection<A>> R collect(List<T> list, Function<? super T,? extends A> function, R targetCollection)
-
collectWithIndex
public static <T,A> MutableList<A> collectWithIndex(List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function)
- Since:
- 9.1
-
collectWithIndex
public static <T,A,R extends Collection<A>> R collectWithIndex(List<T> list, ObjectIntToObjectFunction<? super T,? extends A> function, R targetCollection)
- Since:
- 9.1
-
collectBoolean
public static <T> MutableBooleanList collectBoolean(List<T> list, BooleanFunction<? super T> booleanFunction)
-
collectBoolean
public static <T,R extends MutableBooleanCollection> R collectBoolean(List<T> list, BooleanFunction<? super T> booleanFunction, R target)
-
collectByte
public static <T> MutableByteList collectByte(List<T> list, ByteFunction<? super T> byteFunction)
-
collectByte
public static <T,R extends MutableByteCollection> R collectByte(List<T> list, ByteFunction<? super T> byteFunction, R target)
-
collectChar
public static <T> MutableCharList collectChar(List<T> list, CharFunction<? super T> charFunction)
-
collectChar
public static <T,R extends MutableCharCollection> R collectChar(List<T> list, CharFunction<? super T> charFunction, R target)
-
collectDouble
public static <T> MutableDoubleList collectDouble(List<T> list, DoubleFunction<? super T> doubleFunction)
-
collectDouble
public static <T,R extends MutableDoubleCollection> R collectDouble(List<T> list, DoubleFunction<? super T> doubleFunction, R target)
-
collectFloat
public static <T> MutableFloatList collectFloat(List<T> list, FloatFunction<? super T> floatFunction)
-
collectFloat
public static <T,R extends MutableFloatCollection> R collectFloat(List<T> list, FloatFunction<? super T> floatFunction, R target)
-
collectInt
public static <T> MutableIntList collectInt(List<T> list, IntFunction<? super T> intFunction)
-
collectInt
public static <T,R extends MutableIntCollection> R collectInt(List<T> list, IntFunction<? super T> intFunction, R target)
-
collectLong
public static <T> MutableLongList collectLong(List<T> list, LongFunction<? super T> longFunction)
-
collectLong
public static <T,R extends MutableLongCollection> R collectLong(List<T> list, LongFunction<? super T> longFunction, R target)
-
collectShort
public static <T> MutableShortList collectShort(List<T> list, ShortFunction<? super T> shortFunction)
-
collectShort
public static <T,R extends MutableShortCollection> R collectShort(List<T> list, ShortFunction<? super T> shortFunction, R target)
-
flatCollect
public static <T,A> MutableList<A> flatCollect(List<T> list, Function<? super T,? extends Iterable<A>> function)
- See Also:
Iterate.flatCollect(Iterable, Function)
-
flatCollect
public static <T,A,R extends Collection<A>> R flatCollect(List<T> list, Function<? super T,? extends Iterable<A>> function, R targetCollection)
-
getFirst
public static <T> T getFirst(List<T> collection)
Returns the first element of a list.
-
getLast
public static <T> T getLast(List<T> list)
Returns the last element of a list.
-
forEach
public static <T> void forEach(List<T> list, Procedure<? super T> procedure)
- See Also:
Iterate.forEach(Iterable, Procedure)
-
reverseForEach
public static <T> void reverseForEach(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(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(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(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(List<T1> list1, 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(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
-
detect
public static <T> T detect(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.detect(Iterable, Predicate)
-
detectWith
public static <T,IV> T detectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
detectOptional
public static <T> Optional<T> detectOptional(List<T> list, Predicate<? super T> predicate)
-
detectWithOptional
public static <T,IV> Optional<T> detectWithOptional(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
detectIfNone
public static <T> T detectIfNone(List<T> list, Predicate<? super T> predicate, T ifNone)
-
detectWithIfNone
public static <T,IV> T detectWithIfNone(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue, T ifNone)
-
injectInto
public static <T,IV> IV injectInto(IV injectValue, List<T> list, Function2<? super IV,? super T,? extends IV> function)
-
injectInto
public static <T> int injectInto(int injectValue, List<T> list, IntObjectToIntFunction<? super T> function)
-
injectInto
public static <T> long injectInto(long injectValue, List<T> list, LongObjectToLongFunction<? super T> function)
-
injectInto
public static <T> double injectInto(double injectValue, List<T> list, DoubleObjectToDoubleFunction<? super T> function)
-
injectInto
public static <T> float injectInto(float injectValue, List<T> list, FloatObjectToFloatFunction<? super T> function)
-
sumOfInt
public static <T> long sumOfInt(List<T> list, IntFunction<? super T> function)
-
sumOfLong
public static <T> long sumOfLong(List<T> list, LongFunction<? super T> function)
-
sumOfFloat
public static <T> double sumOfFloat(List<T> list, FloatFunction<? super T> function)
-
sumOfDouble
public static <T> double sumOfDouble(List<T> list, DoubleFunction<? super T> function)
-
sumOfBigDecimal
public static <T> BigDecimal sumOfBigDecimal(List<T> list, Function<? super T,BigDecimal> function)
-
sumOfBigInteger
public static <T> BigInteger sumOfBigInteger(List<T> list, Function<? super T,BigInteger> function)
-
sumByBigDecimal
public static <V,T> MutableMap<V,BigDecimal> sumByBigDecimal(List<T> list, Function<T,V> groupBy, Function<? super T,BigDecimal> function)
-
sumByBigInteger
public static <V,T> MutableMap<V,BigInteger> sumByBigInteger(List<T> list, Function<T,V> groupBy, Function<? super T,BigInteger> function)
-
sumByInt
public static <V,T> ObjectLongMap<V> sumByInt(List<T> list, Function<T,V> groupBy, IntFunction<? super T> function)
-
sumByLong
public static <V,T> ObjectLongMap<V> sumByLong(List<T> list, Function<T,V> groupBy, LongFunction<? super T> function)
-
sumByFloat
public static <V,T> ObjectDoubleMap<V> sumByFloat(List<T> list, Function<T,V> groupBy, FloatFunction<? super T> function)
-
sumByDouble
public static <V,T> ObjectDoubleMap<V> sumByDouble(List<T> list, Function<T,V> groupBy, DoubleFunction<? super T> function)
-
anySatisfy
public static <T> boolean anySatisfy(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.anySatisfy(Iterable, Predicate)
-
anySatisfyWith
public static <T,IV> boolean anySatisfyWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
allSatisfy
public static <T> boolean allSatisfy(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.allSatisfy(Iterable, Predicate)
-
allSatisfyWith
public static <T,IV> boolean allSatisfyWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
noneSatisfy
public static <T> boolean noneSatisfy(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.noneSatisfy(Iterable, Predicate)
-
noneSatisfyWith
public static <T,P> boolean noneSatisfyWith(List<T> list, Predicate2<? super T,? super P> predicate, P injectedValue)
-
selectAndRejectWith
public static <T,IV> Twin<MutableList<T>> selectAndRejectWith(List<T> list, Predicate2<? super T,? super IV> predicate, IV injectedValue)
-
partition
public static <T> PartitionMutableList<T> partition(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.partition(Iterable, Predicate)
-
partitionWith
public static <T,P> PartitionMutableList<T> partitionWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
-
removeIf
public static <T> boolean removeIf(List<T> list, Predicate<? super T> predicate)
- See Also:
Iterate.removeIf(Iterable, Predicate)
-
removeIfWith
public static <T,P> boolean removeIfWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter)
-
removeIf
public static <T> boolean removeIf(List<T> list, Predicate<? super T> predicate, Procedure<? super T> procedure)
-
removeIfWith
public static <T,P> boolean removeIfWith(List<T> list, Predicate2<? super T,? super P> predicate, P parameter, Procedure<? super T> procedure)
-
detectIndex
public static <T> int detectIndex(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(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(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, List<T> list, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)
-
forEachWith
public static <T,P> void forEachWith(List<T> list, Procedure2<? super T,? super P> procedure, P parameter)
-
collectWith
public static <T,P,A> MutableList<A> collectWith(List<T> list, Function2<? super T,? super P,? extends A> function, P parameter)
-
collectWith
public static <T,P,A,R extends Collection<A>> R collectWith(List<T> list, Function2<? super T,? super P,? extends A> function, P parameter, R targetCollection)
-
distinct
@Deprecated public static <T,R extends List<T>> R distinct(List<T> list, R targetList)
Deprecated.in 7.0.
-
distinct
public static <T> MutableList<T> distinct(List<T> list)
- Since:
- 7.0.
-
distinct
public static <T> MutableList<T> distinct(List<T> list, HashingStrategy<? super T> hashingStrategy)
- Since:
- 7.0.
-
distinctBy
public static <T,V> MutableList<T> distinctBy(List<T> list, Function<? super T,? extends V> function)
- Since:
- 9.0
-
reverseThis
public static <T> List<T> reverseThis(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(List<T> list, int count)
- See Also:
Iterate.take(Iterable, int)
-
take
public static <T,R extends Collection<T>> R take(List<T> list, int count, R targetList)
- See Also:
Iterate.take(Iterable, int)
-
drop
public static <T> MutableList<T> drop(List<T> list, int count)
- See Also:
Iterate.drop(Iterable, int)
-
drop
public static <T,R extends Collection<T>> R drop(List<T> list, int count, R targetList)
- See Also:
Iterate.drop(Iterable, int)
-
appendString
public static <T> void appendString(List<T> list, Appendable appendable, String start, String separator, String end)
-
groupBy
public static <T,V> FastListMultimap<V,T> groupBy(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(List<T> list, Function<? super T,? extends V> function, R target)
-
groupByEach
public static <T,V> FastListMultimap<V,T> groupByEach(List<T> list, Function<? super T,? extends Iterable<V>> function)
- See Also:
Iterate.groupByEach(Iterable, Function)
-
groupByEach
public static <T,V,R extends MutableMultimap<V,T>> R groupByEach(List<T> list, Function<? super T,? extends Iterable<V>> function, R target)
-
groupByUniqueKey
public static <K,T> MutableMap<K,T> groupByUniqueKey(List<T> list, Function<? super T,? extends K> function)
-
groupByUniqueKey
public static <K,T,R extends MutableMapIterable<K,T>> R groupByUniqueKey(List<T> list, Function<? super T,? extends K> function, R target)
-
min
public static <T> T min(List<T> list, Comparator<? super T> comparator)
- See Also:
Iterate.min(Iterable, Comparator)
-
minBy
public static <T,V extends Comparable<? super V>> T minBy(List<T> list, Function<? super T,? extends V> function)
-
maxBy
public static <T,V extends Comparable<? super V>> T maxBy(List<T> list, Function<? super T,? extends V> function)
-
max
public static <T> T max(List<T> list, Comparator<? super T> comparator)
- See Also:
Iterate.max(Iterable, Comparator)
-
min
public static <T> T min(List<T> list)
- See Also:
Iterate.min(Iterable)
-
max
public static <T> T max(List<T> list)
- See Also:
Iterate.max(Iterable)
-
chunk
public static <T> RichIterable<RichIterable<T>> chunk(List<T> list, int size)
- See Also:
Iterate.chunk(Iterable, int)
-
zip
public static <X,Y> MutableList<Pair<X,Y>> zip(List<X> list, Iterable<Y> iterable)
- See Also:
Iterate.zip(Iterable, Iterable)
-
zip
public static <X,Y,R extends Collection<Pair<X,Y>>> R zip(List<X> list, Iterable<Y> iterable, R target)
-
zipWithIndex
public static <T> MutableList<Pair<T,Integer>> zipWithIndex(List<T> list)
- See Also:
Iterate.zipWithIndex(Iterable)
-
zipWithIndex
public static <T,R extends Collection<Pair<T,Integer>>> R zipWithIndex(List<T> list, R target)
-
takeWhile
public static <T> MutableList<T> takeWhile(List<T> list, Predicate<? super T> predicate)
- See Also:
ListIterable.takeWhile(Predicate)
-
dropWhile
public static <T> MutableList<T> dropWhile(List<T> list, Predicate<? super T> predicate)
- See Also:
ListIterable.dropWhile(Predicate)
-
partitionWhile
public static <T> PartitionMutableList<T> partitionWhile(List<T> list, Predicate<? super T> predicate)
- See Also:
ListIterable.partitionWhile(Predicate)
-
-