@Immutable public class LazyIterableAdapter<T> extends AbstractLazyIterable<T>
Constructor and Description |
---|
LazyIterableAdapter(Iterable<T> newAdapted) |
Modifier and Type | Method and Description |
---|---|
<V> LazyIterable<V> |
collect(Function<? super T,? extends V> function)
Creates a deferred iterable for collecting elements from the current iterable.
|
<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.
|
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.
|
<V> LazyIterable<V> |
flatCollect(Function<? super T,? extends Iterable<V>> function)
Creates a deferred flattening iterable for the current iterable.
|
void |
forEach(Procedure<? super T> procedure)
The procedure is executed for each element in the iterable.
|
<P> void |
forEachWith(Procedure2<? super T,? super P> procedure,
P parameter)
The procedure2 is evaluated for each element in the iterable with the specified parameter provided
as the second argument.
|
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
|
<R extends Collection<T>> |
into(R target)
Iterates over this iterable adding all elements into the target collection.
|
Iterator<T> |
iterator() |
LazyIterable<T> |
reject(Predicate<? super T> predicate)
Creates a deferred iterable for rejecting elements from the current iterable.
|
LazyIterable<T> |
select(Predicate<? super T> predicate)
Creates a deferred iterable for selecting elements from the current iterable.
|
int |
size()
Returns the number of items in this iterable.
|
LazyIterable<T> |
take(int count)
Creates a deferred take iterable for the current iterable using the specified count as the limit.
|
Object[] |
toArray()
Converts this iterable to an array.
|
aggregateBy, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectBoolean, collectByte, collectByte, collectChar, collectChar, collectDouble, collectDouble, collectFloat, collectFloat, collectIf, collectInt, collectInt, collectLong, collectLong, collectShort, collectShort, collectWith, collectWith, concatenate, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectWith, detectWithIfNone, flatCollect, getFirst, getLast, groupBy, groupBy, groupByEach, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, partition, partitionWith, reject, rejectWith, rejectWith, select, selectInstancesOf, selectWith, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toBag, toList, toMap, toSet, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toStack, toString, zip, zip, zipWithIndex, zipWithIndex
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public void forEach(Procedure<? super T> procedure)
InternalIterable
e.g. people.forEach(new Procedure() { public void value(Person person) { LOGGER.info(person.getName()); } });
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
InternalIterable
e.g. people.forEachWithIndex(new ObjectIntProcedure() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
public <P> void forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
InternalIterable
e.g. people.forEachWith(new Procedure2() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);
public <R extends Collection<T>> R into(R target)
LazyIterable
into
in interface LazyIterable<T>
into
in class AbstractLazyIterable<T>
public LazyIterable<T> select(Predicate<? super T> predicate)
LazyIterable
select
in interface LazyIterable<T>
select
in interface RichIterable<T>
select
in class AbstractLazyIterable<T>
public LazyIterable<T> reject(Predicate<? super T> predicate)
LazyIterable
reject
in interface LazyIterable<T>
reject
in interface RichIterable<T>
reject
in class AbstractLazyIterable<T>
predicate
- a Predicate
to use as the reject criteriaPredicate.accept(Object)
method to evaluate to falsepublic <V> LazyIterable<V> collect(Function<? super T,? extends V> function)
LazyIterable
collect
in interface LazyIterable<T>
collect
in interface RichIterable<T>
collect
in class AbstractLazyIterable<T>
public <V> LazyIterable<V> flatCollect(Function<? super T,? extends Iterable<V>> function)
LazyIterable
flatCollect
in interface LazyIterable<T>
flatCollect
in interface RichIterable<T>
flatCollect
in class AbstractLazyIterable<T>
function
- The Function
to applyfunction
public <V> LazyIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
LazyIterable
collectIf
in interface LazyIterable<T>
collectIf
in interface RichIterable<T>
collectIf
in class AbstractLazyIterable<T>
public LazyIterable<T> take(int count)
LazyIterable
take
in interface LazyIterable<T>
take
in class AbstractLazyIterable<T>
public LazyIterable<T> drop(int count)
LazyIterable
drop
in interface LazyIterable<T>
drop
in class AbstractLazyIterable<T>
public LazyIterable<T> distinct()
LazyIterable
distinct
in interface LazyIterable<T>
distinct
in class AbstractLazyIterable<T>
public Object[] toArray()
RichIterable
toArray
in interface RichIterable<T>
toArray
in class AbstractLazyIterable<T>
Collection.toArray()
public int size()
RichIterable
size
in interface RichIterable<T>
size
in class AbstractLazyIterable<T>
Copyright © 2004–2019. All rights reserved.