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

public Class LazyIterableAdapter<T>

extends AbstractLazyIterable<T>
Class Inheritance
Imports
java.util.Collection, .Iterator, .Optional, org.eclipse.collections.api.LazyIterable, org.eclipse.collections.api.block.function.Function, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.impl.UnmodifiableIteratorAdapter, org.eclipse.collections.impl.utility.Iterate, .LazyIterate

A LazyIterableAdapter wraps any iterable with the LazyIterable interface.

Field Summary

Modifier and TypeField and Description
private final Iterable<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfy.

Implements org.eclipse.collections.api.RichIterable.allSatisfy.

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.

public <P> boolean
allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.allSatisfyWith.

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

public boolean
anySatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfy.

Implements org.eclipse.collections.api.RichIterable.anySatisfy.

Returns true if the predicate evaluates to true for any element of the iterable.

public <P> boolean
anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfyWith.

Implements org.eclipse.collections.api.RichIterable.anySatisfyWith.

Returns true if the predicate evaluates to true for any element of the collection, or return false.

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

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.collect.

Implements org.eclipse.collections.api.LazyIterable.collect, org.eclipse.collections.api.RichIterable.collect.

Creates a deferred iterable for collecting elements from the current iterable.

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

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.collectIf.

Implements org.eclipse.collections.api.LazyIterable.collectIf, org.eclipse.collections.api.RichIterable.collectIf.

Creates a deferred iterable for selecting and collecting elements from the current iterable.

public T
detect(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detect.

Implements org.eclipse.collections.api.RichIterable.detect.

Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.

public Optional<T>
detectOptional(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectOptional.

Implements org.eclipse.collections.api.RichIterable.detectOptional.

Returns the first element of the iterable for which the predicate evaluates to true as an Optional.

public <P> T
detectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectWith.

Implements org.eclipse.collections.api.RichIterable.detectWith.

Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.

public <P> Optional<T>
detectWithOptional(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectWithOptional.

Implements org.eclipse.collections.api.RichIterable.detectWithOptional.

Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.

public LazyIterable<T>
distinct()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.distinct.

Implements org.eclipse.collections.api.LazyIterable.distinct.

Creates a deferred distinct iterable to get distinct elements from the current iterable.

public LazyIterable<T>
drop(int count)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.drop.

Implements org.eclipse.collections.api.LazyIterable.drop.

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

public LazyIterable<T>
public void
each(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

public <V> LazyIterable<V>
public <P> void
forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWith.

Implements org.eclipse.collections.api.InternalIterable.forEachWith.

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

public void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWithIndex.

Implements org.eclipse.collections.api.InternalIterable.forEachWithIndex.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

public T
public T
public <R extends Collection<T>> R
into(R target)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.into.

Implements org.eclipse.collections.api.LazyIterable.into, org.eclipse.collections.api.RichIterable.into.

Iterates over this iterable adding all elements into the target collection.

public boolean
public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public boolean
noneSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfy.

Implements org.eclipse.collections.api.RichIterable.noneSatisfy.

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.

public <P> boolean
noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Returns true if the predicate evaluates to false for every element of the collection, or return false.

public LazyIterable<T>
reject(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.reject.

Implements org.eclipse.collections.api.LazyIterable.reject, org.eclipse.collections.api.RichIterable.reject.

Creates a deferred iterable for rejecting elements from the current iterable.

public LazyIterable<T>
select(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.select.

Implements org.eclipse.collections.api.LazyIterable.select, org.eclipse.collections.api.RichIterable.select.

Creates a deferred iterable for selecting elements from the current iterable.

public int
size()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.size.

Implements org.eclipse.collections.api.RichIterable.size.

Returns the number of items in this iterable.

public LazyIterable<T>
take(int count)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.take.

Implements org.eclipse.collections.api.LazyIterable.take.

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

public LazyIterable<T>
Inherited from org.eclipse.collections.impl.lazy.AbstractLazyIterable:
asLazychunkcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIntcollectLongcollectShortcollectWithconcatenategetOnlygroupBygroupByEachgroupByUniqueKeymaxByOptionalmaxOptionalmaxOptionalminByOptionalminOptionalminOptionalpartitionpartitionWithrejectWithselectInstancesOfselectWithsumByDoublesumByFloatsumByIntsumByLongtaptoStackzipzipWithIndex

Field Detail

adaptedback to summary
private final Iterable<T> adapted

Constructor Detail

LazyIterableAdapterback to summary
public LazyIterableAdapter(Iterable<T> newAdapted)

Method Detail

allSatisfyback to summary
public boolean allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfy.

Implements org.eclipse.collections.api.RichIterable.allSatisfy.

Doc from org.eclipse.collections.api.RichIterable.allSatisfy.

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.

Annotations
@Override
allSatisfyWithback to summary
public <P> boolean allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.allSatisfyWith.

Doc from org.eclipse.collections.api.RichIterable.allSatisfyWith.

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

Annotations
@Override
anySatisfyback to summary
public boolean anySatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfy.

Implements org.eclipse.collections.api.RichIterable.anySatisfy.

Doc from org.eclipse.collections.api.RichIterable.anySatisfy.

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.

Annotations
@Override
anySatisfyWithback to summary
public <P> boolean anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfyWith.

Implements org.eclipse.collections.api.RichIterable.anySatisfyWith.

Doc from org.eclipse.collections.api.RichIterable.anySatisfyWith.

Returns true if the predicate evaluates to true for any element of the collection, or return false. Returns false if the collection is empty.

Annotations
@Override
collectback to summary
public <V> LazyIterable<V> collect(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.collect.

Implements org.eclipse.collections.api.LazyIterable.collect, org.eclipse.collections.api.RichIterable.collect.

Doc from org.eclipse.collections.api.LazyIterable.collect.

Creates a deferred iterable for collecting elements from the current iterable.

Annotations
@Override
collectIfback to summary
public <V> LazyIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.collectIf.

Implements org.eclipse.collections.api.LazyIterable.collectIf, org.eclipse.collections.api.RichIterable.collectIf.

Doc from org.eclipse.collections.api.LazyIterable.collectIf.

Creates a deferred iterable for selecting and collecting elements from the current iterable.

Annotations
@Override
detectback to summary
public T detect(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detect.

Implements org.eclipse.collections.api.RichIterable.detect.

Doc from org.eclipse.collections.api.RichIterable.detect.

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"));
Annotations
@Override
detectOptionalback to summary
public Optional<T> detectOptional(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectOptional.

Implements org.eclipse.collections.api.RichIterable.detectOptional.

Doc from org.eclipse.collections.api.RichIterable.detectOptional.

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"));

Annotations
@Override
detectWithback to summary
public <P> T detectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectWith.

Implements org.eclipse.collections.api.RichIterable.detectWith.

Doc from org.eclipse.collections.api.RichIterable.detectWith.

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");
Annotations
@Override
detectWithOptionalback to summary
public <P> Optional<T> detectWithOptional(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectWithOptional.

Implements org.eclipse.collections.api.RichIterable.detectWithOptional.

Doc from org.eclipse.collections.api.RichIterable.detectWithOptional.

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");

Annotations
@Override
distinctback to summary
public LazyIterable<T> distinct()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.distinct.

Implements org.eclipse.collections.api.LazyIterable.distinct.

Doc from org.eclipse.collections.api.LazyIterable.distinct.

Creates a deferred distinct iterable to get distinct elements from the current iterable.

Annotations
@Override
dropback to summary
public LazyIterable<T> drop(int count)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.drop.

Implements org.eclipse.collections.api.LazyIterable.drop.

Doc from org.eclipse.collections.api.LazyIterable.drop.

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

Annotations
@Override
dropWhileback to summary
public LazyIterable<T> dropWhile(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.dropWhile.

Implements org.eclipse.collections.api.LazyIterable.dropWhile.

Annotations
@Override
eachback to summary
public void each(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.RichIterable.each.

Doc from org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

Example using a Java 8 lambda expression:

people.each(person -> LOGGER.info(person.getName()));
This method is a variant of InternalIterable#forEach(Procedure) that has a signature conflict with Iterable#forEach(java.util.function.Consumer).
Annotations
@Override
flatCollectback to summary
public <V> LazyIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.flatCollect.

Implements org.eclipse.collections.api.LazyIterable.flatCollect, org.eclipse.collections.api.RichIterable.flatCollect.

Doc from org.eclipse.collections.api.LazyIterable.flatCollect.

Creates a deferred flattening iterable for the current iterable.

Annotations
@Override
forEachWithback to summary
public <P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWith.

Implements org.eclipse.collections.api.InternalIterable.forEachWith.

Doc from org.eclipse.collections.api.InternalIterable.forEachWith.

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

Example using a Java 8 lambda:

people.forEachWith((Person person, Person other) ->
    {
        if (person.isRelatedTo(other))
        {
             LOGGER.info(person.getName());
        }
    }, fred);

Example using an anonymous inner class:

people.forEachWith(new Procedure2<Person, Person>()
{
    public void value(Person person, Person other)
    {
        if (person.isRelatedTo(other))
        {
             LOGGER.info(person.getName());
        }
    }
}, fred);
Annotations
@Override
forEachWithIndexback to summary
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWithIndex.

Implements org.eclipse.collections.api.InternalIterable.forEachWithIndex.

Doc from org.eclipse.collections.api.InternalIterable.forEachWithIndex.

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());
    }
});
Annotations
@Override
getFirstback to summary
public T getFirst()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.getFirst.

Implements org.eclipse.collections.api.LazyIterable.getFirst, org.eclipse.collections.api.RichIterable.getFirst.

Doc from org.eclipse.collections.api.RichIterable.getFirst.

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.

Annotations
@Override
getLastback to summary
public T getLast()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.getLast.

Implements org.eclipse.collections.api.RichIterable.getLast.

Doc from org.eclipse.collections.api.RichIterable.getLast.

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.

Annotations
@Override
intoback to summary
public <R extends Collection<T>> R into(R target)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.into.

Implements org.eclipse.collections.api.LazyIterable.into, org.eclipse.collections.api.RichIterable.into.

Doc from org.eclipse.collections.api.LazyIterable.into.

Iterates over this iterable adding all elements into the target collection.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.isEmpty.

Implements org.eclipse.collections.api.RichIterable.isEmpty.

Doc from org.eclipse.collections.api.RichIterable.isEmpty.

Returns true if this iterable has zero items.

Annotations
@Override
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
noneSatisfyback to summary
public boolean noneSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfy.

Implements org.eclipse.collections.api.RichIterable.noneSatisfy.

Doc from org.eclipse.collections.api.RichIterable.noneSatisfy.

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.

Annotations
@Override
noneSatisfyWithback to summary
public <P> boolean noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Doc from org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Returns true if the predicate evaluates to false for every element of the collection, or return false. Returns true if the collection is empty.

Annotations
@Override
rejectback to summary
public LazyIterable<T> reject(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.reject.

Implements org.eclipse.collections.api.LazyIterable.reject, org.eclipse.collections.api.RichIterable.reject.

Doc from org.eclipse.collections.api.LazyIterable.reject.

Creates a deferred iterable for rejecting elements from the current iterable.

Annotations
@Override
selectback to summary
public LazyIterable<T> select(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.select.

Implements org.eclipse.collections.api.LazyIterable.select, org.eclipse.collections.api.RichIterable.select.

Doc from org.eclipse.collections.api.LazyIterable.select.

Creates a deferred iterable for selecting elements from the current iterable.

Annotations
@Override
sizeback to summary
public int size()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.size.

Implements org.eclipse.collections.api.RichIterable.size.

Doc from org.eclipse.collections.api.RichIterable.size.

Returns the number of items in this iterable.

Annotations
@Override
takeback to summary
public LazyIterable<T> take(int count)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.take.

Implements org.eclipse.collections.api.LazyIterable.take.

Doc from org.eclipse.collections.api.LazyIterable.take.

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

Annotations
@Override
takeWhileback to summary
public LazyIterable<T> takeWhile(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.takeWhile.

Implements org.eclipse.collections.api.LazyIterable.takeWhile.

Annotations
@Override