InternalIterable<T>
, java.lang.Iterable<T>
, RichIterable<T>
AbstractLazyIterable
, ChunkBooleanIterable
, ChunkByteIterable
, ChunkCharIterable
, ChunkDoubleIterable
, ChunkFloatIterable
, ChunkIntIterable
, ChunkIterable
, ChunkLongIterable
, ChunkShortIterable
, CollectBooleanToObjectIterable
, CollectByteToObjectIterable
, CollectCharToObjectIterable
, CollectDoubleToObjectIterable
, CollectFloatToObjectIterable
, CollectIntToObjectIterable
, CollectIterable
, CollectLongToObjectIterable
, CollectShortToObjectIterable
, CompositeIterable
, DistinctIterable
, DropIterable
, DropWhileIterable
, FlatCollectBooleanToObjectIterable
, FlatCollectByteToObjectIterable
, FlatCollectCharToObjectIterable
, FlatCollectDoubleToObjectIterable
, FlatCollectFloatToObjectIterable
, FlatCollectIntToObjectIterable
, FlatCollectIterable
, FlatCollectLongToObjectIterable
, FlatCollectShortToObjectIterable
, Interval
, LazyIterableAdapter
, RejectIterable
, ReverseIterable
, SelectInstancesOfIterable
, SelectIterable
, TakeIterable
, TakeWhileIterable
, TapIterable
, ZipIterable
, ZipWithIndexIterable
public interface LazyIterable<T> extends RichIterable<T>
Modifier and Type | Method | Description |
---|---|---|
LazyIterable<RichIterable<T>> |
chunk(int size) |
Creates a deferred chunk iterable.
|
<V> LazyIterable<V> |
collect(Function<? super T,? extends V> function) |
Creates a deferred iterable for collecting elements from the current iterable.
|
LazyBooleanIterable |
collectBoolean(BooleanFunction<? super T> booleanFunction) |
Returns a lazy BooleanIterable which will transform the underlying iterable data to boolean values based on the booleanFunction.
|
LazyByteIterable |
collectByte(ByteFunction<? super T> byteFunction) |
Returns a lazy ByteIterable which will transform the underlying iterable data to byte values based on the byteFunction.
|
LazyCharIterable |
collectChar(CharFunction<? super T> charFunction) |
Returns a lazy CharIterable which will transform the underlying iterable data to char values based on the charFunction.
|
LazyDoubleIterable |
collectDouble(DoubleFunction<? super T> doubleFunction) |
Returns a lazy DoubleIterable which will transform the underlying iterable data to double values based on the doubleFunction.
|
LazyFloatIterable |
collectFloat(FloatFunction<? super T> floatFunction) |
Returns a lazy FloatIterable which will transform the underlying iterable data to float values based on the floatFunction.
|
<V> LazyIterable<V> |
collectIf(Predicate<? super T> predicate,
Function<? super T,? extends V> function) |
Creates a deferred iterable for selecting and collecting elements from the current iterable.
|
LazyIntIterable |
collectInt(IntFunction<? super T> intFunction) |
Returns a lazy IntIterable which will transform the underlying iterable data to int values based on the intFunction.
|
LazyLongIterable |
collectLong(LongFunction<? super T> longFunction) |
Returns a lazy LongIterable which will transform the underlying iterable data to long values based on the longFunction.
|
LazyShortIterable |
collectShort(ShortFunction<? super T> shortFunction) |
Returns a lazy ShortIterable which will transform the underlying iterable data to short values based on the shortFunction.
|
<P,V> LazyIterable<V> |
collectWith(Function2<? super T,? super P,? extends V> function,
P parameter) |
Same as
RichIterable.collect(Function) with a Function2 and specified parameter which is passed to the block. |
LazyIterable<T> |
concatenate(java.lang.Iterable<T> iterable) |
Creates a deferred iterable that will join this iterable with the specified iterable.
|
LazyIterable<T> |
distinct() |
Creates a deferred distinct iterable to get distinct elements from the current iterable.
|
LazyIterable<T> |
drop(int count) |
Creates a deferred drop iterable for the current iterable using the specified count as the limit.
|
LazyIterable<T> |
dropWhile(Predicate<? super T> predicate) |
|
<V> LazyIterable<V> |
flatCollect(Function<? super T,? extends java.lang.Iterable<V>> function) |
Creates a deferred flattening iterable for the current iterable.
|
default <P,V> LazyIterable<V> |
flatCollectWith(Function2<? super T,? super P,? extends java.lang.Iterable<V>> function,
P parameter) |
|
T |
getFirst() |
Returns the first element of an iterable.
|
<R extends java.util.Collection<T>> |
into(R target) |
Iterates over this iterable adding all elements into the target collection.
|
LazyIterable<T> |
reject(Predicate<? super T> predicate) |
Creates a deferred iterable for rejecting elements from the current iterable.
|
<P> LazyIterable<T> |
rejectWith(Predicate2<? super T,? super P> predicate,
P parameter) |
Similar to
RichIterable.reject(Predicate) , except with an evaluation parameter for the second generic argument in Predicate2 . |
LazyIterable<T> |
select(Predicate<? super T> predicate) |
Creates a deferred iterable for selecting elements from the current iterable.
|
<S> LazyIterable<S> |
selectInstancesOf(java.lang.Class<S> clazz) |
Returns all elements of the source collection that are instances of the Class
clazz . |
<P> LazyIterable<T> |
selectWith(Predicate2<? super T,? super P> predicate,
P parameter) |
Similar to
RichIterable.select(Predicate) , except with an evaluation parameter for the second generic argument in Predicate2 . |
LazyIterable<T> |
take(int count) |
Creates a deferred take iterable for the current iterable using the specified count as the limit.
|
LazyIterable<T> |
takeWhile(Predicate<? super T> predicate) |
|
LazyIterable<T> |
tap(Procedure<? super T> procedure) |
Creates a deferred tap iterable.
|
<S> LazyIterable<Pair<T,S>> |
zip(java.lang.Iterable<S> that) |
Creates a deferred zip iterable.
|
LazyIterable<Pair<T,java.lang.Integer>> |
zipWithIndex() |
Creates a deferred zipWithIndex iterable.
|
forEach, forEachWith, forEachWithIndex
aggregateBy, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countBy, countByEach, countByEach, countByWith, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectWith, forEach, getAny, getLast, getOnly, groupBy, groupBy, groupByAndCollect, groupByEach, groupByEach, groupByUniqueKey, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, partition, partitionWith, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
T getFirst()
RichIterable
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.
getFirst
in interface RichIterable<T>
LazyIterable<T> select(Predicate<? super T> predicate)
select
in interface RichIterable<T>
<P> LazyIterable<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterable
RichIterable.select(Predicate)
, except with an evaluation parameter for the second generic argument in Predicate2
.
E.g. return a Collection
of Person elements where the person has an age greater than or equal to 18 years
Example 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));
selectWith
in interface RichIterable<T>
predicate
- a Predicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argument P
in predicate
RichIterable.select(Predicate)
<S> LazyIterable<S> selectInstancesOf(java.lang.Class<S> clazz)
RichIterable
clazz
.
RichIterable<Integer> integers = List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
selectInstancesOf
in interface RichIterable<T>
LazyIterable<T> reject(Predicate<? super T> predicate)
reject
in interface RichIterable<T>
predicate
- a Predicate
to use as the reject criteriaPredicate.accept(Object)
method to evaluate to false<P> LazyIterable<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterable
RichIterable.reject(Predicate)
, except with an evaluation parameter for the second generic argument in Predicate2
.
E.g. return a Collection
of Person elements where the person has an age greater than or equal to 18 years
Example 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));
rejectWith
in interface RichIterable<T>
predicate
- a Predicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argument P
in predicate
RichIterable.select(Predicate)
<V> LazyIterable<V> collect(Function<? super T,? extends V> function)
collect
in interface RichIterable<T>
<P,V> LazyIterable<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
RichIterable
RichIterable.collect(Function)
with a Function2
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));
collectWith
in interface RichIterable<T>
function
- A Function2
to use as the collect transformation functionparameter
- A parameter to pass in for evaluation of the second argument P
in function
RichIterable
that contains the transformed elements returned by Function2.value(Object, Object)
RichIterable.collect(Function)
<V> LazyIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
collectIf
in interface RichIterable<T>
LazyIterable<T> take(int count)
LazyIterable<T> drop(int count)
LazyIterable<T> takeWhile(Predicate<? super T> predicate)
OrderedIterable.takeWhile(Predicate)
LazyIterable<T> dropWhile(Predicate<? super T> predicate)
OrderedIterable.dropWhile(Predicate)
LazyIterable<T> distinct()
<V> LazyIterable<V> flatCollect(Function<? super T,? extends java.lang.Iterable<V>> function)
flatCollect
in interface RichIterable<T>
function
- The Function
to applyfunction
default <P,V> LazyIterable<V> flatCollectWith(Function2<? super T,? super P,? extends java.lang.Iterable<V>> function, P parameter)
flatCollectWith
in interface RichIterable<T>
LazyIterable<T> concatenate(java.lang.Iterable<T> iterable)
<S> LazyIterable<Pair<T,S>> zip(java.lang.Iterable<S> that)
zip
in interface RichIterable<T>
S
- the type of the second half of the returned pairsthat
- The RichIterable
providing the second half of each result pairRichIterable
containing pairs consisting of corresponding elements of this
RichIterable
and that. The length of the returned RichIterable
is the minimum of the lengths of
this RichIterable
and that.LazyIterable<Pair<T,java.lang.Integer>> zipWithIndex()
zipWithIndex
in interface RichIterable<T>
RichIterable
containing pairs consisting of all elements of this RichIterable
paired with their index. Indices start at 0.RichIterable.zip(Iterable)
LazyIterable<RichIterable<T>> chunk(int size)
chunk
in interface RichIterable<T>
size
- the number of elements per chunkRichIterable
containing RichIterable
s of size size
, except the last will be
truncated if the elements don't divide evenly.LazyIterable<T> tap(Procedure<? super T> procedure)
tap
in interface RichIterable<T>
RichIterable.each(Procedure)
,
RichIterable.forEach(Procedure)
<R extends java.util.Collection<T>> R into(R target)
into
in interface RichIterable<T>
LazyBooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction)
collectBoolean
in interface RichIterable<T>
LazyByteIterable collectByte(ByteFunction<? super T> byteFunction)
collectByte
in interface RichIterable<T>
LazyCharIterable collectChar(CharFunction<? super T> charFunction)
collectChar
in interface RichIterable<T>
LazyDoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction)
collectDouble
in interface RichIterable<T>
LazyFloatIterable collectFloat(FloatFunction<? super T> floatFunction)
collectFloat
in interface RichIterable<T>
LazyIntIterable collectInt(IntFunction<? super T> intFunction)
collectInt
in interface RichIterable<T>
LazyLongIterable collectLong(LongFunction<? super T> longFunction)
collectLong
in interface RichIterable<T>
LazyShortIterable collectShort(ShortFunction<? super T> shortFunction)
collectShort
in interface RichIterable<T>
Copyright © 2004–2020. All rights reserved.