Class ImmutableArrayList<T>
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
,SequencedCollection<T>
,ImmutableCollection<T>
,InternalIterable<T>
,ImmutableList<T>
,ListIterable<T>
,OrderedIterable<T>
,ReversibleIterable<T>
,RichIterable<T>
,BatchIterable<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.collections.impl.list.immutable.AbstractImmutableList
AbstractImmutableList.ImmutableSubList<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
allSatisfy
(Predicate<? super T> predicate) Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.boolean
anySatisfy
(Predicate<? super T> predicate) Returns true if the predicate evaluates to true for any element of the iterable.void
appendString
(Appendable appendable, String start, String separator, String end) Prints a string representation of this collection onto the givenAppendable
.void
batchForEach
(Procedure<? super T> procedure, int sectionIndex, int sectionCount) <V> ImmutableList
<V> Returns a new collection with the results of applying the specified function on each element of the source collection.<V> ImmutableList
<V> Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.<P,
V> ImmutableList <V> collectWith
(Function2<? super T, ? super P, ? extends V> function, P parameter) Same asRichIterable.collect(Function)
with aFunction2
and specified parameter which is passed to the block.<P,
V, R extends Collection<V>>
RcollectWith
(Function2<? super T, ? super P, ? extends V> function, P parameter, R target) Same as collectWith but with a targetCollection parameter to gather the results.<V> ImmutableList
<V> collectWithIndex
(ObjectIntToObjectFunction<? super T, ? extends V> function) Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.<V,
R extends Collection<V>>
RcollectWithIndex
(ObjectIntToObjectFunction<? super T, ? extends V> function, R target) Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.boolean
Returns true if the iterable has an element which responds true to element.equals(object).boolean
containsAll
(Collection<?> collection) Returns true if all elements in source are contained in this collection.<S> boolean
corresponds
(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate) Returns true if both OrderedIterables have the same length andpredicate
returns true for all corresponding elements e1 of thisOrderedIterable
and e2 ofother
.int
Return the total number of elements that answer true to the specified predicate.Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.private int
detectNotIndex
(Predicate<? super T> predicate) detectOptional
(Predicate<? super T> predicate) Returns the first element of the iterable for which the predicate evaluates to true as an Optional.<P> T
detectWith
(Predicate2<? super T, ? super P> predicate, P parameter) Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.detectWithOptional
(Predicate2<? super T, ? super P> predicate, P parameter) Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.drop
(int count) Returns an iterable after skipping the firstcount
elements or an empty iterable if thecount
is greater than the length of the iterable.Returns the final elements that do not satisfy the Predicate.void
The procedure is executed for each element in the iterable.boolean
Follows the same general contract asList.equals(Object)
.<V> ImmutableList
<V> flatCollect
(Function<? super T, ? extends Iterable<V>> function) flatCollect
is a special case ofRichIterable.collect(Function)
.<V,
R extends Collection<V>>
RflatCollect
(Function<? super T, ? extends Iterable<V>> function, R target) Same as flatCollect, only the results are collected into the target collection.void
forEachWithIndex
(int from, int to, ObjectIntProcedure<? super T> objectIntProcedure) Iterates over the section of the iterable covered by the specified inclusive indexes.void
forEachWithIndex
(ObjectIntProcedure<? super T> objectIntProcedure) Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.get
(int index) Returns the item at the specified position in this list iterable.int
getBatchCount
(int batchSize) getFirst()
Returns the first element of an iterable.getLast()
Returns the last element of an iterable.int
hashCode()
Follows the same general contract asList.hashCode()
.boolean
immutableArrayListEquals
(ImmutableArrayList<?> otherList) int
Returns the index of the first occurrence of the specified item in this iterable, or -1 if this iterable does not contain the item.<IV> IV
injectInto
(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function) Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.boolean
isEmpty()
Returns true if this iterable has zero items.iterator()
int
lastIndexOf
(Object item) Returns the index of the last occurrence of the specified item in this list, or -1 if this list does not contain the item.<V extends Comparable<? super V>>
TReturns the maximum elements out of this container based on the natural order of the attribute returned by Function.<V extends Comparable<? super V>>
TReturns the minimum elements out of this container based on the natural order of the attribute returned by Function.static <E> ImmutableArrayList
<E> static <E> ImmutableArrayList
<E> newListWith
(E... elements) This method is similar to thewith
method inMutableCollection
with the difference that a new copy of this collection with the element appended will be returned.boolean
noneSatisfy
(Predicate<? super T> predicate) Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.boolean
notEmpty()
The English equivalent of !this.isEmpty()Filters a collection into a PartitionedIterable based on the evaluation of the predicate.partitionWhile
(Predicate<? super T> predicate) Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements.<P> PartitionImmutableList
<T> partitionWith
(Predicate2<? super T, ? super P> predicate, P parameter) Filters a collection into a PartitionIterable based on the evaluation of the predicate.reduce
(BinaryOperator<T> accumulator) This method produces the equivalent result asStream.reduce(BinaryOperator)
.<R> R
reduceInPlace
(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator) This method produces the equivalent result asStream.collect(Supplier, BiConsumer, BiConsumer)
.<R,
A> R reduceInPlace
(Collector<? super T, A, R> collector) This method produces the equivalent result asStream.collect(Collector)
.Returns all elements of the source collection that return false when evaluating of the predicate.<P> ImmutableList
<T> rejectWith
(Predicate2<? super T, ? super P> predicate, P parameter) Similar toRichIterable.reject(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.<P,
R extends Collection<T>>
RrejectWith
(Predicate2<? super T, ? super P> predicate, P parameter, R target) Similar toRichIterable.reject(Predicate, Collection)
, except with an evaluation parameter for the second generic argument inPredicate2
.rejectWithIndex
(ObjectIntPredicate<? super T> predicate) Returns a new ImmutableList with all elements of the collection that return false when evaluating the specified predicate which is supplied each element and its relative index.<R extends Collection<T>>
RrejectWithIndex
(ObjectIntPredicate<? super T> predicate, R target) Adds all elements to the target Collection that return false when evaluating the specified predicate which is supplied each element and its relative index.Returns all elements of the source collection that return true when evaluating the predicate.<S> ImmutableList
<S> selectInstancesOf
(Class<S> clazz) Returns all elements of the source collection that are instances of the Classclazz
.<P> ImmutableList
<T> selectWith
(Predicate2<? super T, ? super P> predicate, P parameter) Similar toRichIterable.select(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.<P,
R extends Collection<T>>
RselectWith
(Predicate2<? super T, ? super P> predicate, P parameter, R target) Similar toRichIterable.select(Predicate, Collection)
, except with an evaluation parameter for the second generic argument inPredicate2
.selectWithIndex
(ObjectIntPredicate<? super T> predicate) Returns a new ImmutableList with all elements of the collection that return true when evaluating the specified predicate which is supplied each element and its relative index.<R extends Collection<T>>
RselectWithIndex
(ObjectIntPredicate<? super T> predicate, R target) Adds all elements to the target Collection that return true when evaluating the specified predicate which is supplied each element and its relative index.int
size()
Returns the number of items in this iterable.summarizeDouble
(DoubleFunction<? super T> function) Returns the result of summarizing the value returned from applying the DoubleFunction to each element of the iterable.summarizeFloat
(FloatFunction<? super T> function) Returns the result of summarizing the value returned from applying the FloatFunction to each element of the iterable.summarizeInt
(IntFunction<? super T> function) Returns the result of summarizing the value returned from applying the IntFunction to each element of the iterable.summarizeLong
(LongFunction<? super T> function) Returns the result of summarizing the value returned from applying the LongFunction to each element of the iterable.double
sumOfDouble
(DoubleFunction<? super T> function) Returns the final double result of evaluating function for each element of the iterable and adding the results together.double
sumOfFloat
(FloatFunction<? super T> function) Returns the final double result of evaluating function for each element of the iterable and adding the results together.long
sumOfInt
(IntFunction<? super T> function) Returns the final long result of evaluating function for each element of the iterable and adding the results together.long
sumOfLong
(LongFunction<? super T> function) Returns the final long result of evaluating function for each element of the iterable and adding the results together.take
(int count) Returns the firstcount
elements of the iterable or all the elements in the iterable ifcount
is greater than the length of the iterable.Returns the initial elements that satisfy the Predicate.Object[]
toArray()
Converts this iterable to an array.<E> E[]
toArray
(E[] a) Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.toString()
Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.Methods inherited from class org.eclipse.collections.impl.list.immutable.AbstractImmutableList
add, addAll, asParallel, asReversed, castToList, chunk, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, detectIndex, detectLastIndex, distinct, distinct, distinctBy, forEach, forEachWith, groupBy, groupBy, groupByEach, groupByEach, injectInto, injectInto, injectInto, injectInto, listIterator, listIterator, max, max, min, min, newMutable, newWithAll, newWithout, newWithoutAll, regularListEquals, remove, replaceAll, set, sort, subList, tap, toImmutable, toReversed, zip, zipWithIndex
Methods inherited from class org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection
add, addAll, castToCollection, clear, countBy, countByEach, countByWith, groupByUniqueKey, parallelStream, remove, removeAll, removeAllFrom, retainAll, stream, sumByDouble, sumByFloat, sumByInt, sumByLong
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfyWith, anySatisfyWith, appendString, asLazy, collect, collectIf, containsAllArguments, containsAllIterable, countWith, detectWithIfNone, forEach, groupByUniqueKey, into, noneSatisfyWith, reject, select, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.collections.impl.parallel.BatchIterable
forEach
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.eclipse.collections.api.collection.ImmutableCollection
aggregateBy, aggregateInPlaceBy, castToCollection, countBy, countByEach, countByWith, groupByUniqueKey, parallelStream, stream, sumByDouble, sumByFloat, sumByInt, sumByLong
Methods inherited from interface org.eclipse.collections.api.list.ImmutableList
flatCollectWith, toImmutableList
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
Methods inherited from interface java.util.List
add, addAll, addFirst, addLast, clear, remove, removeAll, removeFirst, removeLast, retainAll, reversed
Methods inherited from interface org.eclipse.collections.api.list.ListIterable
binarySearch, binarySearch, forEachInBoth
Methods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
getFirstOptional, getLastOptional, toStack, zip, zipWithIndex
Methods inherited from interface org.eclipse.collections.api.ordered.ReversibleIterable
reverseForEach, reverseForEachWithIndex
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfyWith, anySatisfyWith, appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, countBy, countByEach, countByWith, countWith, detectIfNone, detectWithIfNone, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupByAndCollect, groupByUniqueKey, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, makeString, makeString, makeString, makeString, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, noneSatisfyWith, reject, select, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
items
-
-
Constructor Details
-
ImmutableArrayList
ImmutableArrayList(T[] newElements)
-
-
Method Details
-
newList
-
newListWith
-
newWith
Description copied from interface:ImmutableCollection
This method is similar to thewith
method inMutableCollection
with the difference that a new copy of this collection with the element appended will be returned.- Specified by:
newWith
in interfaceImmutableCollection<T>
- Specified by:
newWith
in interfaceImmutableList<T>
-
hashCode
public int hashCode()Description copied from interface:ListIterable
Follows the same general contract asList.hashCode()
.- Specified by:
hashCode
in interfaceCollection<T>
- Specified by:
hashCode
in interfaceList<T>
- Specified by:
hashCode
in interfaceListIterable<T>
- Overrides:
hashCode
in classAbstractImmutableList<T>
-
equals
Description copied from interface:ListIterable
Follows the same general contract asList.equals(Object)
.- Specified by:
equals
in interfaceCollection<T>
- Specified by:
equals
in interfaceList<T>
- Specified by:
equals
in interfaceListIterable<T>
- Overrides:
equals
in classAbstractImmutableList<T>
-
immutableArrayListEquals
-
notEmpty
public boolean notEmpty()Description copied from interface:RichIterable
The English equivalent of !this.isEmpty()- Specified by:
notEmpty
in interfaceRichIterable<T>
-
getFirst
Description copied from interface:RichIterable
Returns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
- Specified by:
getFirst
in interfaceList<T>
- Specified by:
getFirst
in interfaceListIterable<T>
- Specified by:
getFirst
in interfaceOrderedIterable<T>
- Specified by:
getFirst
in interfaceRichIterable<T>
- Specified by:
getFirst
in interfaceSequencedCollection<T>
- Overrides:
getFirst
in classAbstractImmutableList<T>
-
getLast
Description copied from interface:RichIterable
Returns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
- Specified by:
getLast
in interfaceList<T>
- Specified by:
getLast
in interfaceListIterable<T>
- Specified by:
getLast
in interfaceOrderedIterable<T>
- Specified by:
getLast
in interfaceRichIterable<T>
- Specified by:
getLast
in interfaceSequencedCollection<T>
- Overrides:
getLast
in classAbstractImmutableList<T>
-
each
Description copied from interface:RichIterable
The procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
people.each(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
This method is a variant ofInternalIterable.forEach(Procedure)
that has a signature conflict withIterable.forEach(java.util.function.Consumer)
.- Specified by:
each
in interfaceRichIterable<T>
- See Also:
-
forEachWithIndex
Description copied from interface:InternalIterable
Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
- Specified by:
forEachWithIndex
in interfaceInternalIterable<T>
- Specified by:
forEachWithIndex
in interfaceOrderedIterable<T>
- Overrides:
forEachWithIndex
in classAbstractImmutableList<T>
-
batchForEach
- Specified by:
batchForEach
in interfaceBatchIterable<T>
-
getBatchCount
public int getBatchCount(int batchSize) - Specified by:
getBatchCount
in interfaceBatchIterable<T>
-
forEachWithIndex
Description copied from interface:OrderedIterable
Iterates over the section of the iterable covered by the specified inclusive indexes. The indexes are both inclusive.e.g. OrderedIterable<People> people = FastList.newListWith(ted, mary, bob, sally) people.forEachWithIndex(0, 1, new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info(person.getName()); } });
This code would output ted and mary's names.
- Specified by:
forEachWithIndex
in interfaceOrderedIterable<T>
- Overrides:
forEachWithIndex
in classAbstractImmutableList<T>
-
select
Description copied from interface:RichIterable
Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter.Example using a Java 8 lambda expression:
RichIterable<Person> selected = people.select(person -> person.getAddress().getCity().equals("London"));
Example using an anonymous inner class:
RichIterable<Person> selected = people.select(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getCity().equals("London"); } });
- Specified by:
select
in interfaceImmutableCollection<T>
- Specified by:
select
in interfaceImmutableList<T>
- Specified by:
select
in interfaceListIterable<T>
- Specified by:
select
in interfaceOrderedIterable<T>
- Specified by:
select
in interfaceReversibleIterable<T>
- Specified by:
select
in interfaceRichIterable<T>
- Overrides:
select
in classAbstractImmutableList<T>
-
selectWith
Description copied from interface:RichIterable
Similar toRichIterable.select(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.E.g. return a
Collection
of Person elements where the person has an age greater than or equal to 18 yearsExample using a Java 8 lambda expression:
RichIterable<Person> selected = people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
Example using an anonymous inner class:
RichIterable<Person> selected = people.selectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge()>= age; } }, Integer.valueOf(18));
- Specified by:
selectWith
in interfaceImmutableCollection<T>
- Specified by:
selectWith
in interfaceImmutableList<T>
- Specified by:
selectWith
in interfaceListIterable<T>
- Specified by:
selectWith
in interfaceOrderedIterable<T>
- Specified by:
selectWith
in interfaceReversibleIterable<T>
- Specified by:
selectWith
in interfaceRichIterable<T>
- Overrides:
selectWith
in classAbstractImmutableList<T>
- Parameters:
predicate
- aPredicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argumentP
inpredicate
- See Also:
-
selectWith
public <P,R extends Collection<T>> R selectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target) Description copied from interface:RichIterable
Similar toRichIterable.select(Predicate, Collection)
, except with an evaluation parameter for the second generic argument inPredicate2
.E.g. return a
Collection
of Person elements where the person has an age greater than or equal to 18 yearsExample using a Java 8 lambda expression:
MutableList<Person> selected = people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18), Lists.mutable.empty());
Example using an anonymous inner class:
MutableList<Person> selected = people.selectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge()>= age; } }, Integer.valueOf(18), Lists.mutable.empty());
- Specified by:
selectWith
in interfaceRichIterable<T>
- Overrides:
selectWith
in classAbstractImmutableList<T>
- Parameters:
predicate
- aPredicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argumentP
inpredicate
target
- the Collection to append to for all elements in thisRichIterable
that meet select criteriapredicate
- Returns:
targetCollection
, which contains appended elements as a result of the select criteria- See Also:
-
reject
Description copied from interface:RichIterable
Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)).Example using a Java 8 lambda expression:
RichIterable<Person> rejected = people.reject(person -> person.person.getLastName().equals("Smith"));
Example using an anonymous inner class:
RichIterable<Person> rejected = people.reject(new Predicate<Person>() { public boolean accept(Person person) { return person.person.getLastName().equals("Smith"); } });
- Specified by:
reject
in interfaceImmutableCollection<T>
- Specified by:
reject
in interfaceImmutableList<T>
- Specified by:
reject
in interfaceListIterable<T>
- Specified by:
reject
in interfaceOrderedIterable<T>
- Specified by:
reject
in interfaceReversibleIterable<T>
- Specified by:
reject
in interfaceRichIterable<T>
- Overrides:
reject
in classAbstractImmutableList<T>
- Parameters:
predicate
- aPredicate
to use as the reject criteria- Returns:
- a RichIterable that contains elements that cause
Predicate.accept(Object)
method to evaluate to false
-
rejectWith
Description copied from interface:RichIterable
Similar toRichIterable.reject(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.E.g. return a
Collection
of Person elements where the person has an age greater than or equal to 18 yearsExample using a Java 8 lambda expression:
RichIterable<Person> rejected = people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
Example using an anonymous inner class:
MutableList<Person> rejected = people.rejectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge() < age; } }, Integer.valueOf(18));
- Specified by:
rejectWith
in interfaceImmutableCollection<T>
- Specified by:
rejectWith
in interfaceImmutableList<T>
- Specified by:
rejectWith
in interfaceListIterable<T>
- Specified by:
rejectWith
in interfaceOrderedIterable<T>
- Specified by:
rejectWith
in interfaceReversibleIterable<T>
- Specified by:
rejectWith
in interfaceRichIterable<T>
- Overrides:
rejectWith
in classAbstractImmutableList<T>
- Parameters:
predicate
- aPredicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argumentP
inpredicate
- See Also:
-
rejectWith
public <P,R extends Collection<T>> R rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target) Description copied from interface:RichIterable
Similar toRichIterable.reject(Predicate, Collection)
, except with an evaluation parameter for the second generic argument inPredicate2
.E.g. return a
Collection
of Person elements where the person has an age greater than or equal to 18 yearsExample using a Java 8 lambda expression:
MutableList<Person> rejected = people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18), Lists.mutable.empty());
Example using an anonymous inner class:
MutableList<Person> rejected = people.rejectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge() < age; } }, Integer.valueOf(18), Lists.mutable.empty());
- Specified by:
rejectWith
in interfaceRichIterable<T>
- Overrides:
rejectWith
in classAbstractImmutableList<T>
- Parameters:
predicate
- aPredicate2
to use as the reject criteriaparameter
- a parameter to pass in for evaluation of the second argumentP
inpredicate
target
- the Collection to append to for all elements in thisRichIterable
that causePredicate#accept(Object)
method to evaluate to false- Returns:
targetCollection
, which contains appended elements as a result of the reject criteria- See Also:
-
partition
Description copied from interface:RichIterable
Filters a collection into a PartitionedIterable based on the evaluation of the predicate.Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(person -> person.getAddress().getState().getName().equals("New York"));
Example using an anonymous inner class:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getState().getName().equals("New York"); } });
- Specified by:
partition
in interfaceImmutableCollection<T>
- Specified by:
partition
in interfaceImmutableList<T>
- Specified by:
partition
in interfaceListIterable<T>
- Specified by:
partition
in interfaceOrderedIterable<T>
- Specified by:
partition
in interfaceReversibleIterable<T>
- Specified by:
partition
in interfaceRichIterable<T>
- Overrides:
partition
in classAbstractImmutableList<T>
-
partitionWith
public <P> PartitionImmutableList<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter) Description copied from interface:RichIterable
Filters a collection into a PartitionIterable based on the evaluation of the predicate.Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
Example using an anonymous inner class:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partitionWith(new Predicate2<Person, String>() { public boolean accept(Person person, String state) { return person.getAddress().getState().getName().equals(state); } }, "New York");
- Specified by:
partitionWith
in interfaceImmutableCollection<T>
- Specified by:
partitionWith
in interfaceImmutableList<T>
- Specified by:
partitionWith
in interfaceListIterable<T>
- Specified by:
partitionWith
in interfaceOrderedIterable<T>
- Specified by:
partitionWith
in interfaceReversibleIterable<T>
- Specified by:
partitionWith
in interfaceRichIterable<T>
- Overrides:
partitionWith
in classAbstractImmutableList<T>
-
selectInstancesOf
Description copied from interface:RichIterable
Returns all elements of the source collection that are instances of the Classclazz
.RichIterable<Integer> integers = List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
- Specified by:
selectInstancesOf
in interfaceImmutableCollection<T>
- Specified by:
selectInstancesOf
in interfaceImmutableList<T>
- Specified by:
selectInstancesOf
in interfaceListIterable<T>
- Specified by:
selectInstancesOf
in interfaceOrderedIterable<T>
- Specified by:
selectInstancesOf
in interfaceReversibleIterable<T>
- Specified by:
selectInstancesOf
in interfaceRichIterable<T>
- Overrides:
selectInstancesOf
in classAbstractImmutableList<T>
-
collect
Description copied from interface:RichIterable
Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.Example using a Java 8 lambda expression:
RichIterable<String> names = people.collect(person -> person.getFirstName() + " " + person.getLastName());
Example using an anonymous inner class:
RichIterable<String> names = people.collect(new Function<Person, String>() { public String valueOf(Person person) { return person.getFirstName() + " " + person.getLastName(); } });
- Specified by:
collect
in interfaceImmutableCollection<T>
- Specified by:
collect
in interfaceImmutableList<T>
- Specified by:
collect
in interfaceListIterable<T>
- Specified by:
collect
in interfaceOrderedIterable<T>
- Specified by:
collect
in interfaceReversibleIterable<T>
- Specified by:
collect
in interfaceRichIterable<T>
- Overrides:
collect
in classAbstractImmutableList<T>
-
collectWith
public <P,V> ImmutableList<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter) Description copied from interface:RichIterable
Same asRichIterable.collect(Function)
with aFunction2
and specified parameter which is passed to the block.Example using a Java 8 lambda expression:
RichIterable<Integer> integers = Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
Example using an anonymous inner class:
Function2<Integer, Integer, Integer> addParameterFunction = new Function2<Integer, Integer, Integer>() { public Integer value(Integer each, Integer parameter) { return each + parameter; } }; RichIterable<Integer> integers = Lists.mutable.with(1, 2, 3).collectWith(addParameterFunction, Integer.valueOf(1));
- Specified by:
collectWith
in interfaceImmutableCollection<T>
- Specified by:
collectWith
in interfaceImmutableList<T>
- Specified by:
collectWith
in interfaceListIterable<T>
- Specified by:
collectWith
in interfaceOrderedIterable<T>
- Specified by:
collectWith
in interfaceReversibleIterable<T>
- Specified by:
collectWith
in interfaceRichIterable<T>
- Overrides:
collectWith
in classAbstractImmutableList<T>
- Parameters:
function
- AFunction2
to use as the collect transformation functionparameter
- A parameter to pass in for evaluation of the second argumentP
infunction
- Returns:
- A new
RichIterable
that contains the transformed elements returned byFunction2.value(Object, Object)
- See Also:
-
collectWithIndex
public <V> ImmutableList<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function) Description copied from interface:OrderedIterable
Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndex
in interfaceImmutableList<T>
- Specified by:
collectWithIndex
in interfaceListIterable<T>
- Specified by:
collectWithIndex
in interfaceOrderedIterable<T>
- Specified by:
collectWithIndex
in interfaceReversibleIterable<T>
- Since:
- 9.1.
-
collectWithIndex
public <V,R extends Collection<V>> R collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function, R target) Description copied from interface:OrderedIterable
Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndex
in interfaceOrderedIterable<T>
- Since:
- 9.1.
-
selectWithIndex
Description copied from interface:ImmutableList
Returns a new ImmutableList with all elements of the collection that return true when evaluating the specified predicate which is supplied each element and its relative index.- Specified by:
selectWithIndex
in interfaceImmutableList<T>
- Specified by:
selectWithIndex
in interfaceListIterable<T>
- Since:
- 11.0
-
rejectWithIndex
Description copied from interface:ImmutableList
Returns a new ImmutableList with all elements of the collection that return false when evaluating the specified predicate which is supplied each element and its relative index.- Specified by:
rejectWithIndex
in interfaceImmutableList<T>
- Specified by:
rejectWithIndex
in interfaceListIterable<T>
- Since:
- 11.0
-
selectWithIndex
public <R extends Collection<T>> R selectWithIndex(ObjectIntPredicate<? super T> predicate, R target) Description copied from interface:OrderedIterable
Adds all elements to the target Collection that return true when evaluating the specified predicate which is supplied each element and its relative index.- Specified by:
selectWithIndex
in interfaceOrderedIterable<T>
- Since:
- 11.0
-
rejectWithIndex
public <R extends Collection<T>> R rejectWithIndex(ObjectIntPredicate<? super T> predicate, R target) Description copied from interface:OrderedIterable
Adds all elements to the target Collection that return false when evaluating the specified predicate which is supplied each element and its relative index.- Specified by:
rejectWithIndex
in interfaceOrderedIterable<T>
- Since:
- 11.0
-
collectIf
public <V> ImmutableList<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function) Description copied from interface:RichIterable
Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. This is the optimized equivalent of calling iterable.select(predicate).collect(function).Example using a Java 8 lambda and method reference:
RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString);
Example using Predicates factory:
RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
- Specified by:
collectIf
in interfaceImmutableCollection<T>
- Specified by:
collectIf
in interfaceImmutableList<T>
- Specified by:
collectIf
in interfaceListIterable<T>
- Specified by:
collectIf
in interfaceOrderedIterable<T>
- Specified by:
collectIf
in interfaceReversibleIterable<T>
- Specified by:
collectIf
in interfaceRichIterable<T>
- Overrides:
collectIf
in classAbstractImmutableList<T>
-
collectWith
public <P,V, R collectWithR extends Collection<V>> (Function2<? super T, ? super P, ? extends V> function, P parameter, R target) Description copied from interface:RichIterable
Same as collectWith but with a targetCollection parameter to gather the results.Example using a Java 8 lambda expression:
MutableSet<Integer> integers = Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1), Sets.mutable.empty());
Example using an anonymous inner class:
Function2<Integer, Integer, Integer> addParameterFunction = new Function2<Integer, Integer, Integer>() { public Integer value(final Integer each, final Integer parameter) { return each + parameter; } }; MutableSet<Integer> integers = Lists.mutable.with(1, 2, 3).collectWith(addParameterFunction, Integer.valueOf(1), Sets.mutable.empty());
- Specified by:
collectWith
in interfaceRichIterable<T>
- Overrides:
collectWith
in classAbstractImmutableList<T>
- Parameters:
function
- aFunction2
to use as the collect transformation functionparameter
- a parameter to pass in for evaluation of the second argumentP
infunction
target
- the Collection to append to for all elements in thisRichIterable
that meet select criteriafunction
- Returns:
targetCollection
, which contains appended elements as a result of the collect transformation
-
flatCollect
Description copied from interface:RichIterable
flatCollect
is a special case ofRichIterable.collect(Function)
. Withcollect
, when theFunction
returns a collection, the result is a collection of collections.flatCollect
outputs a single "flattened" collection instead. This method is commonly called flatMap.Consider the following example where we have a
Person
class, and eachPerson
has a list ofAddress
objects. Take the followingFunction
:Function<Person, List<Address>> addressFunction = Person::getAddresses; RichIterable<Person> people = ...;
Usingcollect
returns a collection of collections of addresses.RichIterable<List<Address>> addresses = people.collect(addressFunction);
UsingflatCollect
returns a single flattened list of addresses.RichIterable<Address> addresses = people.flatCollect(addressFunction);
- Specified by:
flatCollect
in interfaceImmutableCollection<T>
- Specified by:
flatCollect
in interfaceImmutableList<T>
- Specified by:
flatCollect
in interfaceListIterable<T>
- Specified by:
flatCollect
in interfaceOrderedIterable<T>
- Specified by:
flatCollect
in interfaceReversibleIterable<T>
- Specified by:
flatCollect
in interfaceRichIterable<T>
- Overrides:
flatCollect
in classAbstractImmutableList<T>
- Parameters:
function
- TheFunction
to apply- Returns:
- a new flattened collection produced by applying the given
function
-
flatCollect
public <V,R extends Collection<V>> R flatCollect(Function<? super T, ? extends Iterable<V>> function, R target) Description copied from interface:RichIterable
Same as flatCollect, only the results are collected into the target collection.- Specified by:
flatCollect
in interfaceRichIterable<T>
- Overrides:
flatCollect
in classAbstractImmutableList<T>
- Parameters:
function
- TheFunction
to applytarget
- The collection into which results should be added.- Returns:
target
, which will contain a flattened collection of results produced by applying the givenfunction
- See Also:
-
detect
Description copied from interface:RichIterable
Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. This method is commonly called find.Example using a Java 8 lambda expression:
Person person = people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
Example using an anonymous inner class:
Person person = people.detect(new Predicate<Person>() { public boolean accept(Person person) { return person.getFirstName().equals("John") && person.getLastName().equals("Smith"); } });
- Specified by:
detect
in interfaceRichIterable<T>
- Overrides:
detect
in classAbstractRichIterable<T>
-
detectWith
Description copied from interface:RichIterable
Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.Example using a Java 8 lambda expression:
Person person = people.detectWith((person, fullName) -> person.getFullName().equals(fullName), "John Smith");
Example using an anonymous inner class:
Person person = people.detectWith(new Predicate2<Person, String>() { public boolean accept(Person person, String fullName) { return person.getFullName().equals(fullName); } }, "John Smith");
- Specified by:
detectWith
in interfaceRichIterable<T>
- Overrides:
detectWith
in classAbstractRichIterable<T>
-
detectOptional
Description copied from interface:RichIterable
Returns the first element of the iterable for which the predicate evaluates to true as an Optional. This method is commonly called find.Example using a Java 8 lambda expression:
Person person = people.detectOptional(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
- Specified by:
detectOptional
in interfaceRichIterable<T>
- Overrides:
detectOptional
in classAbstractRichIterable<T>
-
detectWithOptional
Description copied from interface:RichIterable
Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.Example using a Java 8 lambda expression:
Optional<Person> person = people.detectWithOptional((person, fullName) -> person.getFullName().equals(fullName), "John Smith");
- Specified by:
detectWithOptional
in interfaceRichIterable<T>
- Overrides:
detectWithOptional
in classAbstractRichIterable<T>
-
count
Description copied from interface:RichIterable
Return the total number of elements that answer true to the specified predicate.Example using a Java 8 lambda expression:
int count = people.count(person -> person.getAddress().getState().getName().equals("New York"));
Example using an anonymous inner class:
int count = people.count(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getState().getName().equals("New York"); } });
- Specified by:
count
in interfaceRichIterable<T>
- Overrides:
count
in classAbstractImmutableList<T>
-
corresponds
Description copied from interface:OrderedIterable
Returns true if both OrderedIterables have the same length andpredicate
returns true for all corresponding elements e1 of thisOrderedIterable
and e2 ofother
. Thepredicate
is evaluated for each element at the same position of eachOrderedIterable
in a forward iteration order. This is a short circuit pattern.- Specified by:
corresponds
in interfaceOrderedIterable<T>
- Overrides:
corresponds
in classAbstractImmutableList<T>
-
anySatisfy
Description copied from interface:RichIterable
Returns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty, or if no element returned true when evaluating the predicate.- Specified by:
anySatisfy
in interfaceRichIterable<T>
- Overrides:
anySatisfy
in classAbstractRichIterable<T>
-
allSatisfy
Description copied from interface:RichIterable
Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.- Specified by:
allSatisfy
in interfaceRichIterable<T>
- Overrides:
allSatisfy
in classAbstractRichIterable<T>
-
noneSatisfy
Description copied from interface:RichIterable
Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.- Specified by:
noneSatisfy
in interfaceRichIterable<T>
- Overrides:
noneSatisfy
in classAbstractRichIterable<T>
-
summarizeInt
Description copied from interface:RichIterable
Returns the result of summarizing the value returned from applying the IntFunction to each element of the iterable.IntSummaryStatistics stats = Lists.mutable.with(1, 2, 3).summarizeInt(Integer::intValue);
- Specified by:
summarizeInt
in interfaceRichIterable<T>
- Since:
- 8.0
-
summarizeFloat
Description copied from interface:RichIterable
Returns the result of summarizing the value returned from applying the FloatFunction to each element of the iterable.DoubleSummaryStatistics stats = Lists.mutable.with(1, 2, 3).summarizeFloat(Integer::floatValue);
- Specified by:
summarizeFloat
in interfaceRichIterable<T>
- Since:
- 8.0
-
summarizeLong
Description copied from interface:RichIterable
Returns the result of summarizing the value returned from applying the LongFunction to each element of the iterable.LongSummaryStatistics stats = Lists.mutable.with(1, 2, 3).summarizeLong(Integer::longValue);
- Specified by:
summarizeLong
in interfaceRichIterable<T>
- Since:
- 8.0
-
summarizeDouble
Description copied from interface:RichIterable
Returns the result of summarizing the value returned from applying the DoubleFunction to each element of the iterable.DoubleSummaryStatistics stats = Lists.mutable.with(1, 2, 3).summarizeDouble(Integer::doubleValue);
- Specified by:
summarizeDouble
in interfaceRichIterable<T>
- Since:
- 8.0
-
reduce
Description copied from interface:RichIterable
This method produces the equivalent result asStream.reduce(BinaryOperator)
.- Specified by:
reduce
in interfaceRichIterable<T>
- Overrides:
reduce
in classAbstractImmutableCollection<T>
- Since:
- 8.0
-
reduceInPlace
Description copied from interface:RichIterable
This method produces the equivalent result asStream.collect(Collector)
.MutableObjectLongMap<Integer> map2 = Lists.mutable.with(1, 2, 3, 4, 5).reduceInPlace(Collectors2.sumByInt(i -> Integer.valueOf(i % 2), Integer::intValue));
- Specified by:
reduceInPlace
in interfaceRichIterable<T>
- Since:
- 8.0
-
reduceInPlace
Description copied from interface:RichIterable
This method produces the equivalent result asStream.collect(Supplier, BiConsumer, BiConsumer)
. The combiner used in collect is unnecessary in the serial case, so is not included in the API.- Specified by:
reduceInPlace
in interfaceRichIterable<T>
- Since:
- 8.0
-
sumOfInt
Description copied from interface:RichIterable
Returns the final long result of evaluating function for each element of the iterable and adding the results together.- Specified by:
sumOfInt
in interfaceRichIterable<T>
- Overrides:
sumOfInt
in classAbstractImmutableList<T>
-
sumOfLong
Description copied from interface:RichIterable
Returns the final long result of evaluating function for each element of the iterable and adding the results together.- Specified by:
sumOfLong
in interfaceRichIterable<T>
- Overrides:
sumOfLong
in classAbstractImmutableList<T>
-
sumOfFloat
Description copied from interface:RichIterable
Returns the final double result of evaluating function for each element of the iterable and adding the results together. It uses Kahan summation algorithm to reduce numerical error.- Specified by:
sumOfFloat
in interfaceRichIterable<T>
- Overrides:
sumOfFloat
in classAbstractImmutableList<T>
-
sumOfDouble
Description copied from interface:RichIterable
Returns the final double result of evaluating function for each element of the iterable and adding the results together. It uses Kahan summation algorithm to reduce numerical error.- Specified by:
sumOfDouble
in interfaceRichIterable<T>
- Overrides:
sumOfDouble
in classAbstractImmutableList<T>
-
injectInto
Description copied from interface:RichIterable
Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter. This method is commonly called fold or sometimes reduce.- Specified by:
injectInto
in interfaceRichIterable<T>
- Overrides:
injectInto
in classAbstractImmutableList<T>
-
size
public int size()Description copied from interface:RichIterable
Returns the number of items in this iterable.- Specified by:
size
in interfaceBatchIterable<T>
- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceList<T>
- Specified by:
size
in interfaceRichIterable<T>
-
isEmpty
public boolean isEmpty()Description copied from interface:RichIterable
Returns true if this iterable has zero items.- Specified by:
isEmpty
in interfaceCollection<T>
- Specified by:
isEmpty
in interfaceList<T>
- Specified by:
isEmpty
in interfaceRichIterable<T>
- Overrides:
isEmpty
in classAbstractRichIterable<T>
-
contains
Description copied from interface:RichIterable
Returns true if the iterable has an element which responds true to element.equals(object).- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceList<T>
- Specified by:
contains
in interfaceRichIterable<T>
- Overrides:
contains
in classAbstractRichIterable<T>
-
iterator
-
toArray
Description copied from interface:RichIterable
Converts this iterable to an array.- Specified by:
toArray
in interfaceCollection<T>
- Specified by:
toArray
in interfaceList<T>
- Specified by:
toArray
in interfaceRichIterable<T>
- Overrides:
toArray
in classAbstractRichIterable<T>
- See Also:
-
toArray
public <E> E[] toArray(E[] a) Description copied from interface:RichIterable
Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.- Specified by:
toArray
in interfaceCollection<T>
- Specified by:
toArray
in interfaceList<T>
- Specified by:
toArray
in interfaceRichIterable<T>
- Overrides:
toArray
in classAbstractRichIterable<T>
- See Also:
-
appendString
Description copied from interface:RichIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byRichIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfaceRichIterable<T>
- Overrides:
appendString
in classAbstractImmutableList<T>
-
toString
Description copied from class:AbstractRichIterable
Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.Assert.assertEquals("[]", Lists.mutable.empty().toString()); Assert.assertEquals("[1]", Lists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", Lists.mutable.with(1, 2, 3).toString());
- Specified by:
toString
in interfaceRichIterable<T>
- Overrides:
toString
in classAbstractRichIterable<T>
- Returns:
- a string representation of this collection.
- See Also:
-
containsAll
Description copied from interface:RichIterable
Returns true if all elements in source are contained in this collection.- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceList<T>
- Specified by:
containsAll
in interfaceRichIterable<T>
- Overrides:
containsAll
in classAbstractRichIterable<T>
- See Also:
-
get
Description copied from interface:ListIterable
Returns the item at the specified position in this list iterable. -
indexOf
Description copied from interface:OrderedIterable
Returns the index of the first occurrence of the specified item in this iterable, or -1 if this iterable does not contain the item.- Specified by:
indexOf
in interfaceList<T>
- Specified by:
indexOf
in interfaceOrderedIterable<T>
- Overrides:
indexOf
in classAbstractImmutableList<T>
- See Also:
-
lastIndexOf
Description copied from interface:ListIterable
Returns the index of the last occurrence of the specified item in this list, or -1 if this list does not contain the item.- Specified by:
lastIndexOf
in interfaceList<T>
- Specified by:
lastIndexOf
in interfaceListIterable<T>
- Overrides:
lastIndexOf
in classAbstractImmutableList<T>
-
minBy
Description copied from interface:RichIterable
Returns the minimum elements out of this container based on the natural order of the attribute returned by Function.- Specified by:
minBy
in interfaceRichIterable<T>
- Overrides:
minBy
in classAbstractImmutableList<T>
-
maxBy
Description copied from interface:RichIterable
Returns the maximum elements out of this container based on the natural order of the attribute returned by Function.- Specified by:
maxBy
in interfaceRichIterable<T>
- Overrides:
maxBy
in classAbstractImmutableList<T>
-
take
Description copied from interface:ReversibleIterable
Returns the firstcount
elements of the iterable or all the elements in the iterable ifcount
is greater than the length of the iterable.- Specified by:
take
in interfaceImmutableList<T>
- Specified by:
take
in interfaceListIterable<T>
- Specified by:
take
in interfaceReversibleIterable<T>
- Overrides:
take
in classAbstractImmutableList<T>
- Parameters:
count
- the number of items to take.
-
takeWhile
Description copied from interface:ListIterable
Returns the initial elements that satisfy the Predicate. Short circuits at the first element which does not satisfy the Predicate.- Specified by:
takeWhile
in interfaceImmutableList<T>
- Specified by:
takeWhile
in interfaceListIterable<T>
- Specified by:
takeWhile
in interfaceOrderedIterable<T>
- Specified by:
takeWhile
in interfaceReversibleIterable<T>
- Overrides:
takeWhile
in classAbstractImmutableList<T>
-
drop
Description copied from interface:ReversibleIterable
Returns an iterable after skipping the firstcount
elements or an empty iterable if thecount
is greater than the length of the iterable.- Specified by:
drop
in interfaceImmutableList<T>
- Specified by:
drop
in interfaceListIterable<T>
- Specified by:
drop
in interfaceReversibleIterable<T>
- Overrides:
drop
in classAbstractImmutableList<T>
- Parameters:
count
- the number of items to drop.
-
dropWhile
Description copied from interface:ListIterable
Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.- Specified by:
dropWhile
in interfaceImmutableList<T>
- Specified by:
dropWhile
in interfaceListIterable<T>
- Specified by:
dropWhile
in interfaceOrderedIterable<T>
- Specified by:
dropWhile
in interfaceReversibleIterable<T>
- Overrides:
dropWhile
in classAbstractImmutableList<T>
-
partitionWhile
Description copied from interface:ListIterable
Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. Short circuits at the first element which does satisfy the Predicate.- Specified by:
partitionWhile
in interfaceImmutableList<T>
- Specified by:
partitionWhile
in interfaceListIterable<T>
- Specified by:
partitionWhile
in interfaceOrderedIterable<T>
- Specified by:
partitionWhile
in interfaceReversibleIterable<T>
- Overrides:
partitionWhile
in classAbstractImmutableList<T>
-
detectNotIndex
-
spliterator
- Specified by:
spliterator
in interfaceCollection<T>
- Specified by:
spliterator
in interfaceImmutableCollection<T>
- Specified by:
spliterator
in interfaceIterable<T>
- Specified by:
spliterator
in interfaceList<T>
- Overrides:
spliterator
in classAbstractImmutableCollection<T>
- Since:
- 9.0
-