Top Description Fields Constructors Methods
org.eclipse.collections.impl.utility

public final Class LazyIterate

extends Object
Class Inheritance
Imports
org.eclipse.collections.api.LazyIterable, .RichIterable, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.predicate.Predicate, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.factory.Lists, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.lazy.ChunkIterable, .CollectIterable, .CompositeIterable, .DistinctIterable, .DropIterable, .DropWhileIterable, .FlatCollectIterable, .LazyIterableAdapter, .RejectIterable, .SelectInstancesOfIterable, .SelectIterable, .TakeIterable, .TakeWhileIterable, .TapIterable, .ZipIterable, .ZipWithIndexIterable, org.eclipse.collections.impl.tuple.Tuples

LazyIterate is a factory class which creates "deferred" iterables around the specified iterables. A "deferred" iterable performs some operation, such as filtering or transforming, when the result iterable is iterated over. This makes the operation very memory efficient, because you don't have to create intermediate collections during the operation.
Since
1.0

Field Summary

Modifier and TypeField and Description
private static final LazyIterable<?>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T> LazyIterable<T>
adapt(Iterable<T> iterable)

Creates a deferred rich iterable for the specified iterable.

public static <A, B> LazyIterable<Pair<A, B>>
cartesianProduct(Iterable<A> iterable1, Iterable<B> iterable2)

Create a deferred cartesian product of the two specified iterables.

public static <A, B, C> LazyIterable<C>
cartesianProduct(Iterable<A> iterable1, Iterable<B> iterable2, Function2<? super A, ? super B, ? extends C> function)

Create a deferred cartesian product of the two specified iterables.

public static <T> LazyIterable<RichIterable<T>>
chunk(Iterable<T> iterable, int size)

public static <T, V> LazyIterable<V>
collect(Iterable<T> iterable, Function<? super T, ? extends V> function)

Creates a deferred transforming iterable for the specified iterable.

public static <T, V> LazyIterable<V>
collectIf(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Creates a deferred filtering and transforming iterable for the specified iterable.

public static <T> LazyIterable<T>
concatenate(Iterable<T>... iterables)

Combines iterables into a deferred composite iterable.

public static <T> LazyIterable<T>
distinct(Iterable<T> iterable)

Creates a deferred distinct iterable for the specified iterable.

public static <T> LazyIterable<T>
drop(Iterable<T> iterable, int count)

Creates a deferred drop iterable for the specified iterable using the specified count as the size to drop.

public static <T> LazyIterable<T>
dropWhile(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred dropWhile iterable for the specified iterable using the specified count as the size to drop.

public static <T> LazyIterable<T>
public static <T, V> LazyIterable<V>
flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function)

Creates a deferred flattening iterable for the specified iterable.

public static <T> LazyIterable<T>
reject(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred negative filtering iterable for the specified iterable.

public static <T> LazyIterable<T>
select(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred filtering iterable for the specified iterable.

public static <T> LazyIterable<T>
selectInstancesOf(Iterable<?> iterable, Class<T> clazz)

public static <T> LazyIterable<T>
take(Iterable<T> iterable, int count)

Creates a deferred take iterable for the specified iterable using the specified count as the limit.

public static <T> LazyIterable<T>
takeWhile(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred takeWhile iterable for the specified iterable using the specified predicate.

public static <T> LazyIterable<T>
tap(Iterable<T> iterable, Procedure<? super T> procedure)

Creates a deferred tap iterable for the specified iterable.

public static <A, B> LazyIterable<Pair<A, B>>
zip(Iterable<A> as, Iterable<B> bs)

public static <T> LazyIterable<Pair<T, Integer>>
zipWithIndex(Iterable<T> iterable)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_ITERABLEback to summary
private static final LazyIterable<?> EMPTY_ITERABLE

Constructor Detail

LazyIterateback to summary
private LazyIterate()

Method Detail

adaptback to summary
public static <T> LazyIterable<T> adapt(Iterable<T> iterable)

Creates a deferred rich iterable for the specified iterable.

cartesianProductback to summary
public static <A, B> LazyIterable<Pair<A, B>> cartesianProduct(Iterable<A> iterable1, Iterable<B> iterable2)

Create a deferred cartesian product of the two specified iterables. See LazyIterate#cartesianProduct(Iterable, Iterable, Function2) about performance and presence of duplicates.

Since
10.0
cartesianProductback to summary
public static <A, B, C> LazyIterable<C> cartesianProduct(Iterable<A> iterable1, Iterable<B> iterable2, Function2<? super A, ? super B, ? extends C> function)

Create a deferred cartesian product of the two specified iterables. This operation has O(n^2) performance. The presence of duplicates in the resulting iterable is both dependent on the presence of duplicates in the two specified iterables, and on the behaviour of the terminating operation that is applied to the resulting lazy iterable.

Since
10.0
chunkback to summary
public static <T> LazyIterable<RichIterable<T>> chunk(Iterable<T> iterable, int size)
collectback to summary
public static <T, V> LazyIterable<V> collect(Iterable<T> iterable, Function<? super T, ? extends V> function)

Creates a deferred transforming iterable for the specified iterable.

collectIfback to summary
public static <T, V> LazyIterable<V> collectIf(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Creates a deferred filtering and transforming iterable for the specified iterable.

concatenateback to summary
public static <T> LazyIterable<T> concatenate(Iterable<T>... iterables)

Combines iterables into a deferred composite iterable.

distinctback to summary
public static <T> LazyIterable<T> distinct(Iterable<T> iterable)

Creates a deferred distinct iterable for the specified iterable.

Since
5.0
dropback to summary
public static <T> LazyIterable<T> drop(Iterable<T> iterable, int count)

Creates a deferred drop iterable for the specified iterable using the specified count as the size to drop.

dropWhileback to summary
public static <T> LazyIterable<T> dropWhile(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred dropWhile iterable for the specified iterable using the specified count as the size to drop. Short circuits at the first element which satisfies the Predicate.

Since
8.0
emptyback to summary
public static <T> LazyIterable<T> empty()
flatCollectback to summary
public static <T, V> LazyIterable<V> flatCollect(Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function)

Creates a deferred flattening iterable for the specified iterable.

rejectback to summary
public static <T> LazyIterable<T> reject(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred negative filtering iterable for the specified iterable.

selectback to summary
public static <T> LazyIterable<T> select(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred filtering iterable for the specified iterable.

selectInstancesOfback to summary
public static <T> LazyIterable<T> selectInstancesOf(Iterable<?> iterable, Class<T> clazz)
takeback to summary
public static <T> LazyIterable<T> take(Iterable<T> iterable, int count)

Creates a deferred take iterable for the specified iterable using the specified count as the limit.

takeWhileback to summary
public static <T> LazyIterable<T> takeWhile(Iterable<T> iterable, Predicate<? super T> predicate)

Creates a deferred takeWhile iterable for the specified iterable using the specified predicate. Short circuits at the first element which does not satisfy the Predicate.

Since
8.0
tapback to summary
public static <T> LazyIterable<T> tap(Iterable<T> iterable, Procedure<? super T> procedure)

Creates a deferred tap iterable for the specified iterable.

Since
6.0
zipback to summary
public static <A, B> LazyIterable<Pair<A, B>> zip(Iterable<A> as, Iterable<B> bs)
zipWithIndexback to summary
public static <T> LazyIterable<Pair<T, Integer>> zipWithIndex(Iterable<T> iterable)