Class AbstractLazyIterable<T>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.lazy.AbstractLazyIterable<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,InternalIterable<T>,LazyIterable<T>,RichIterable<T>
- Direct Known Subclasses:
ByteBooleanHashMap.KeyValuesView,ByteByteHashMap.KeyValuesView,ByteCharHashMap.KeyValuesView,ByteDoubleHashMap.KeyValuesView,ByteFloatHashMap.KeyValuesView,ByteIntHashMap.KeyValuesView,ByteLongHashMap.KeyValuesView,ByteObjectHashMap.KeyValuesView,ByteShortHashMap.KeyValuesView,CharBooleanHashMap.KeyValuesView,CharByteHashMap.KeyValuesView,CharCharHashMap.KeyValuesView,CharDoubleHashMap.KeyValuesView,CharFloatHashMap.KeyValuesView,CharIntHashMap.KeyValuesView,CharLongHashMap.KeyValuesView,CharObjectHashMap.KeyValuesView,CharShortHashMap.KeyValuesView,ChunkBooleanIterable,ChunkByteIterable,ChunkCharIterable,ChunkDoubleIterable,ChunkFloatIterable,ChunkIntIterable,ChunkIterable,ChunkLongIterable,ChunkShortIterable,CollectBooleanToObjectIterable,CollectByteToObjectIterable,CollectCharToObjectIterable,CollectDoubleToObjectIterable,CollectFloatToObjectIterable,CollectIntToObjectIterable,CollectIterable,CollectLongToObjectIterable,CollectShortToObjectIterable,CompositeIterable,DistinctIterable,DoubleBooleanHashMap.KeyValuesView,DoubleByteHashMap.KeyValuesView,DoubleCharHashMap.KeyValuesView,DoubleDoubleHashMap.KeyValuesView,DoubleFloatHashMap.KeyValuesView,DoubleIntHashMap.KeyValuesView,DoubleLongHashMap.KeyValuesView,DoubleObjectHashMap.KeyValuesView,DoubleShortHashMap.KeyValuesView,DropIterable,DropWhileIterable,FlatCollectBooleanToObjectIterable,FlatCollectByteToObjectIterable,FlatCollectCharToObjectIterable,FlatCollectDoubleToObjectIterable,FlatCollectFloatToObjectIterable,FlatCollectIntToObjectIterable,FlatCollectIterable,FlatCollectLongToObjectIterable,FlatCollectShortToObjectIterable,FloatBooleanHashMap.KeyValuesView,FloatByteHashMap.KeyValuesView,FloatCharHashMap.KeyValuesView,FloatDoubleHashMap.KeyValuesView,FloatFloatHashMap.KeyValuesView,FloatIntHashMap.KeyValuesView,FloatLongHashMap.KeyValuesView,FloatObjectHashMap.KeyValuesView,FloatShortHashMap.KeyValuesView,ImmutableTreeSet.SortedSetIterableParallelIterable.SortedSetIterableParallelBatchLazyIterable,IntBooleanHashMap.KeyValuesView,IntByteHashMap.KeyValuesView,IntCharHashMap.KeyValuesView,IntDoubleHashMap.KeyValuesView,Interval,IntFloatHashMap.KeyValuesView,IntIntHashMap.KeyValuesView,IntLongHashMap.KeyValuesView,IntObjectHashMap.KeyValuesView,IntShortHashMap.KeyValuesView,LazyIterableAdapter,ListIterableParallelIterable.ListIterableParallelBatchLazyIterable,LongBooleanHashMap.KeyValuesView,LongByteHashMap.KeyValuesView,LongCharHashMap.KeyValuesView,LongDoubleHashMap.KeyValuesView,LongFloatHashMap.KeyValuesView,LongIntHashMap.KeyValuesView,LongLongHashMap.KeyValuesView,LongObjectHashMap.KeyValuesView,LongShortHashMap.KeyValuesView,ObjectBooleanHashMap.KeysView,ObjectBooleanHashMap.KeyValuesView,ObjectBooleanHashMapWithHashingStrategy.KeysView,ObjectBooleanHashMapWithHashingStrategy.KeyValuesView,ObjectByteHashMap.KeysView,ObjectByteHashMap.KeyValuesView,ObjectByteHashMapWithHashingStrategy.KeysView,ObjectByteHashMapWithHashingStrategy.KeyValuesView,ObjectCharHashMap.KeysView,ObjectCharHashMap.KeyValuesView,ObjectCharHashMapWithHashingStrategy.KeysView,ObjectCharHashMapWithHashingStrategy.KeyValuesView,ObjectDoubleHashMap.KeysView,ObjectDoubleHashMap.KeyValuesView,ObjectDoubleHashMapWithHashingStrategy.KeysView,ObjectDoubleHashMapWithHashingStrategy.KeyValuesView,ObjectFloatHashMap.KeysView,ObjectFloatHashMap.KeyValuesView,ObjectFloatHashMapWithHashingStrategy.KeysView,ObjectFloatHashMapWithHashingStrategy.KeyValuesView,ObjectIntHashMap.KeysView,ObjectIntHashMap.KeyValuesView,ObjectIntHashMapWithHashingStrategy.KeysView,ObjectIntHashMapWithHashingStrategy.KeyValuesView,ObjectLongHashMap.KeysView,ObjectLongHashMap.KeyValuesView,ObjectLongHashMapWithHashingStrategy.KeysView,ObjectLongHashMapWithHashingStrategy.KeyValuesView,ObjectShortHashMap.KeysView,ObjectShortHashMap.KeyValuesView,ObjectShortHashMapWithHashingStrategy.KeysView,ObjectShortHashMapWithHashingStrategy.KeyValuesView,RejectIterable,ReverseIterable,SelectInstancesOfIterable,SelectIterable,ShortBooleanHashMap.KeyValuesView,ShortByteHashMap.KeyValuesView,ShortCharHashMap.KeyValuesView,ShortDoubleHashMap.KeyValuesView,ShortFloatHashMap.KeyValuesView,ShortIntHashMap.KeyValuesView,ShortLongHashMap.KeyValuesView,ShortObjectHashMap.KeyValuesView,ShortShortHashMap.KeyValuesView,TakeIterable,TakeWhileIterable,TapIterable,UnifiedSet.UnifiedSetParallelUnsortedIterable.UnifiedSetParallelSplitLazyIterable,UnifiedSetWithHashingStrategy.UnifiedSetParallelUnsortedIterable.UnifiedSetParallelSplitLazyIterable,ZipIterable,ZipWithIndexIterable
public abstract class AbstractLazyIterable<T> extends AbstractRichIterable<T> implements LazyIterable<T>
AbstractLazyIterable provides a base from which deferred iterables such as SelectIterable, RejectIterable and CollectIterable can be derived.
-
-
Constructor Summary
Constructors Constructor Description AbstractLazyIterable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LazyIterable<T>asLazy()Returns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).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.LazyBooleanIterablecollectBoolean(BooleanFunction<? super T> booleanFunction)Returns a lazy BooleanIterable which will transform the underlying iterable data to boolean values based on the booleanFunction.LazyByteIterablecollectByte(ByteFunction<? super T> byteFunction)Returns a lazy ByteIterable which will transform the underlying iterable data to byte values based on the byteFunction.LazyCharIterablecollectChar(CharFunction<? super T> charFunction)Returns a lazy CharIterable which will transform the underlying iterable data to char values based on the charFunction.LazyDoubleIterablecollectDouble(DoubleFunction<? super T> doubleFunction)Returns a lazy DoubleIterable which will transform the underlying iterable data to double values based on the doubleFunction.LazyFloatIterablecollectFloat(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.LazyIntIterablecollectInt(IntFunction<? super T> intFunction)Returns a lazy IntIterable which will transform the underlying iterable data to int values based on the intFunction.LazyLongIterablecollectLong(LongFunction<? super T> longFunction)Returns a lazy LongIterable which will transform the underlying iterable data to long values based on the longFunction.LazyShortIterablecollectShort(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 asRichIterable.collect(Function)with aFunction2and 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.TgetFirst()Returns the first element of an iterable.TgetLast()Returns the last element of an iterable.TgetOnly()Returns the element if the iterable has exactly one element.<V> Multimap<V,T>groupBy(Function<? super T,? extends V> function)For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.<V> Multimap<V,T>groupByEach(Function<? super T,? extends java.lang.Iterable<V>> function)Similar toRichIterable.groupBy(Function), except the result of evaluating function will return a collection of keys for each value.<V> MapIterable<V,T>groupByUniqueKey(Function<? super T,? extends V> function)For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key.<R extends java.util.Collection<T>>
Rinto(R target)Adds all the elements in this iterable to the specific target Collection.booleanisEmpty()Returns true if this iterable has zero items.<V extends java.lang.Comparable<? super V>>
java.util.Optional<T>maxByOptional(Function<? super T,? extends V> function)Returns the maximum elements out of this container based on the natural order of the attribute returned by Function as an Optional.java.util.Optional<T>maxOptional()Returns the maximum element out of this container based on the natural order as an Optional.java.util.Optional<T>maxOptional(java.util.Comparator<? super T> comparator)Returns the maximum element out of this container based on the comparator as an Optional.<V extends java.lang.Comparable<? super V>>
java.util.Optional<T>minByOptional(Function<? super T,? extends V> function)Returns the minimum elements out of this container based on the natural order of the attribute returned by Function as an Optional.java.util.Optional<T>minOptional()Returns the minimum element out of this container based on the natural order as an Optional.java.util.Optional<T>minOptional(java.util.Comparator<? super T> comparator)Returns the minimum element out of this container based on the comparator as an Optional.PartitionMutableList<T>partition(Predicate<? super T> predicate)Filters a collection into a PartitionedIterable based on the evaluation of the predicate.<P> PartitionMutableList<T>partitionWith(Predicate2<? super T,? super P> predicate, P parameter)Filters a collection into a PartitionIterable based on the evaluation of the predicate.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 toRichIterable.reject(Predicate), except with an evaluation parameter for the second generic argument inPredicate2.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 Classclazz.<P> LazyIterable<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.intsize()Returns the number of items in this iterable.<V> ObjectDoubleMap<V>sumByDouble(Function<? super T,? extends V> groupBy, DoubleFunction<? super T> function)Groups and sums the values using the two specified functions.<V> ObjectDoubleMap<V>sumByFloat(Function<? super T,? extends V> groupBy, FloatFunction<? super T> function)Groups and sums the values using the two specified functions.<V> ObjectLongMap<V>sumByInt(Function<? super T,? extends V> groupBy, IntFunction<? super T> function)Groups and sums the values using the two specified functions.<V> ObjectLongMap<V>sumByLong(Function<? super T,? extends V> groupBy, LongFunction<? super T> function)Groups and sums the values using the two specified functions.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.MutableStack<T>toStack()<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.-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, collect, collectIf, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countByEach, countWith, detect, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, forEachWith, forEachWithIndex, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndex
-
Methods inherited from interface org.eclipse.collections.api.LazyIterable
flatCollectWith, toArray, toArray, toImmutableBag, toImmutableList, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, aggregateBy, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countBy, countByEach, countByEach, countByWith, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, makeString, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceBy, reduceBy, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toImmutableBiMap, toImmutableMap, 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, toString, zip, zipWithIndex
-
-
-
-
Method Detail
-
asLazy
public LazyIterable<T> asLazy()
Description copied from interface:RichIterableReturns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).- Specified by:
asLazyin interfaceRichIterable<T>- Overrides:
asLazyin classAbstractRichIterable<T>
-
into
public <R extends java.util.Collection<T>> R into(R target)
Description copied from interface:RichIterableAdds all the elements in this iterable to the specific target Collection.- Specified by:
intoin interfaceLazyIterable<T>- Specified by:
intoin interfaceRichIterable<T>- Overrides:
intoin classAbstractRichIterable<T>
-
size
public int size()
Description copied from interface:RichIterableReturns the number of items in this iterable.- Specified by:
sizein interfaceRichIterable<T>
-
isEmpty
public boolean isEmpty()
Description copied from interface:RichIterableReturns true if this iterable has zero items.- Specified by:
isEmptyin interfaceRichIterable<T>- Overrides:
isEmptyin classAbstractRichIterable<T>
-
getFirst
public T getFirst()
Description copied from interface:RichIterableReturns 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:
getFirstin interfaceLazyIterable<T>- Specified by:
getFirstin interfaceRichIterable<T>
-
getLast
public T getLast()
Description copied from interface:RichIterableReturns 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:
getLastin interfaceRichIterable<T>
-
getOnly
public T getOnly()
Description copied from interface:RichIterableReturns the element if the iterable has exactly one element. Otherwise, throwIllegalStateException.- Specified by:
getOnlyin interfaceRichIterable<T>- Returns:
- an element of an iterable.
-
select
public LazyIterable<T> select(Predicate<? super T> predicate)
Description copied from interface:LazyIterableCreates a deferred iterable for selecting elements from the current iterable.- Specified by:
selectin interfaceLazyIterable<T>- Specified by:
selectin interfaceRichIterable<T>
-
selectWith
public <P> LazyIterable<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:RichIterableSimilar toRichIterable.select(Predicate), except with an evaluation parameter for the second generic argument inPredicate2.E.g. return a
Collectionof 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));- Specified by:
selectWithin interfaceLazyIterable<T>- Specified by:
selectWithin interfaceRichIterable<T>- Parameters:
predicate- aPredicate2to use as the select criteriaparameter- a parameter to pass in for evaluation of the second argumentPinpredicate- See Also:
RichIterable.select(Predicate)
-
reject
public LazyIterable<T> reject(Predicate<? super T> predicate)
Description copied from interface:LazyIterableCreates a deferred iterable for rejecting elements from the current iterable.- Specified by:
rejectin interfaceLazyIterable<T>- Specified by:
rejectin interfaceRichIterable<T>- Parameters:
predicate- aPredicateto use as the reject criteria- Returns:
- a RichIterable that contains elements that cause
Predicate.accept(Object)method to evaluate to false
-
rejectWith
public <P> LazyIterable<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:RichIterableSimilar toRichIterable.reject(Predicate), except with an evaluation parameter for the second generic argument inPredicate2.E.g. return a
Collectionof 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));- Specified by:
rejectWithin interfaceLazyIterable<T>- Specified by:
rejectWithin interfaceRichIterable<T>- Parameters:
predicate- aPredicate2to use as the select criteriaparameter- a parameter to pass in for evaluation of the second argumentPinpredicate- See Also:
RichIterable.select(Predicate)
-
partition
public PartitionMutableList<T> partition(Predicate<? super T> predicate)
Description copied from interface:RichIterableFilters 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"));- Specified by:
partitionin interfaceRichIterable<T>
-
partitionWith
public <P> PartitionMutableList<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:RichIterableFilters 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");- Specified by:
partitionWithin interfaceRichIterable<T>
-
selectInstancesOf
public <S> LazyIterable<S> selectInstancesOf(java.lang.Class<S> clazz)
Description copied from interface:RichIterableReturns 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:
selectInstancesOfin interfaceLazyIterable<T>- Specified by:
selectInstancesOfin interfaceRichIterable<T>
-
collect
public <V> LazyIterable<V> collect(Function<? super T,? extends V> function)
Description copied from interface:LazyIterableCreates a deferred iterable for collecting elements from the current iterable.- Specified by:
collectin interfaceLazyIterable<T>- Specified by:
collectin interfaceRichIterable<T>
-
collectBoolean
public LazyBooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction)
Description copied from interface:LazyIterableReturns a lazy BooleanIterable which will transform the underlying iterable data to boolean values based on the booleanFunction.- Specified by:
collectBooleanin interfaceLazyIterable<T>- Specified by:
collectBooleanin interfaceRichIterable<T>
-
collectByte
public LazyByteIterable collectByte(ByteFunction<? super T> byteFunction)
Description copied from interface:LazyIterableReturns a lazy ByteIterable which will transform the underlying iterable data to byte values based on the byteFunction.- Specified by:
collectBytein interfaceLazyIterable<T>- Specified by:
collectBytein interfaceRichIterable<T>
-
collectChar
public LazyCharIterable collectChar(CharFunction<? super T> charFunction)
Description copied from interface:LazyIterableReturns a lazy CharIterable which will transform the underlying iterable data to char values based on the charFunction.- Specified by:
collectCharin interfaceLazyIterable<T>- Specified by:
collectCharin interfaceRichIterable<T>
-
collectDouble
public LazyDoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction)
Description copied from interface:LazyIterableReturns a lazy DoubleIterable which will transform the underlying iterable data to double values based on the doubleFunction.- Specified by:
collectDoublein interfaceLazyIterable<T>- Specified by:
collectDoublein interfaceRichIterable<T>
-
collectFloat
public LazyFloatIterable collectFloat(FloatFunction<? super T> floatFunction)
Description copied from interface:LazyIterableReturns a lazy FloatIterable which will transform the underlying iterable data to float values based on the floatFunction.- Specified by:
collectFloatin interfaceLazyIterable<T>- Specified by:
collectFloatin interfaceRichIterable<T>
-
collectInt
public LazyIntIterable collectInt(IntFunction<? super T> intFunction)
Description copied from interface:LazyIterableReturns a lazy IntIterable which will transform the underlying iterable data to int values based on the intFunction.- Specified by:
collectIntin interfaceLazyIterable<T>- Specified by:
collectIntin interfaceRichIterable<T>
-
collectLong
public LazyLongIterable collectLong(LongFunction<? super T> longFunction)
Description copied from interface:LazyIterableReturns a lazy LongIterable which will transform the underlying iterable data to long values based on the longFunction.- Specified by:
collectLongin interfaceLazyIterable<T>- Specified by:
collectLongin interfaceRichIterable<T>
-
collectShort
public LazyShortIterable collectShort(ShortFunction<? super T> shortFunction)
Description copied from interface:LazyIterableReturns a lazy ShortIterable which will transform the underlying iterable data to short values based on the shortFunction.- Specified by:
collectShortin interfaceLazyIterable<T>- Specified by:
collectShortin interfaceRichIterable<T>
-
collectWith
public <P,V> LazyIterable<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
Description copied from interface:RichIterableSame asRichIterable.collect(Function)with aFunction2and 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));- Specified by:
collectWithin interfaceLazyIterable<T>- Specified by:
collectWithin interfaceRichIterable<T>- Parameters:
function- AFunction2to use as the collect transformation functionparameter- A parameter to pass in for evaluation of the second argumentPinfunction- Returns:
- A new
RichIterablethat contains the transformed elements returned byFunction2.value(Object, Object) - See Also:
RichIterable.collect(Function)
-
flatCollect
public <V> LazyIterable<V> flatCollect(Function<? super T,? extends java.lang.Iterable<V>> function)
Description copied from interface:LazyIterableCreates a deferred flattening iterable for the current iterable.- Specified by:
flatCollectin interfaceLazyIterable<T>- Specified by:
flatCollectin interfaceRichIterable<T>- Parameters:
function- TheFunctionto apply- Returns:
- a new flattened collection produced by applying the given
function
-
concatenate
public LazyIterable<T> concatenate(java.lang.Iterable<T> iterable)
Description copied from interface:LazyIterableCreates a deferred iterable that will join this iterable with the specified iterable.- Specified by:
concatenatein interfaceLazyIterable<T>
-
collectIf
public <V> LazyIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
Description copied from interface:LazyIterableCreates a deferred iterable for selecting and collecting elements from the current iterable.- Specified by:
collectIfin interfaceLazyIterable<T>- Specified by:
collectIfin interfaceRichIterable<T>
-
take
public LazyIterable<T> take(int count)
Description copied from interface:LazyIterableCreates a deferred take iterable for the current iterable using the specified count as the limit.- Specified by:
takein interfaceLazyIterable<T>
-
drop
public LazyIterable<T> drop(int count)
Description copied from interface:LazyIterableCreates a deferred drop iterable for the current iterable using the specified count as the limit.- Specified by:
dropin interfaceLazyIterable<T>
-
takeWhile
public LazyIterable<T> takeWhile(Predicate<? super T> predicate)
- Specified by:
takeWhilein interfaceLazyIterable<T>- See Also:
OrderedIterable.takeWhile(Predicate)
-
dropWhile
public LazyIterable<T> dropWhile(Predicate<? super T> predicate)
- Specified by:
dropWhilein interfaceLazyIterable<T>- See Also:
OrderedIterable.dropWhile(Predicate)
-
distinct
public LazyIterable<T> distinct()
Description copied from interface:LazyIterableCreates a deferred distinct iterable to get distinct elements from the current iterable.- Specified by:
distinctin interfaceLazyIterable<T>
-
toStack
public MutableStack<T> toStack()
-
groupBy
public <V> Multimap<V,T> groupBy(Function<? super T,? extends V> function)
Description copied from interface:RichIterableFor each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName = people.groupBy(Person::getLastName);- Specified by:
groupByin interfaceRichIterable<T>
-
groupByEach
public <V> Multimap<V,T> groupByEach(Function<? super T,? extends java.lang.Iterable<V>> function)
Description copied from interface:RichIterableSimilar toRichIterable.groupBy(Function), except the result of evaluating function will return a collection of keys for each value.- Specified by:
groupByEachin interfaceRichIterable<T>
-
groupByUniqueKey
public <V> MapIterable<V,T> groupByUniqueKey(Function<? super T,? extends V> function)
Description copied from interface:RichIterableFor each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key. The generated keys must each be unique, or else an exception is thrown.- Specified by:
groupByUniqueKeyin interfaceRichIterable<T>- See Also:
RichIterable.groupBy(Function)
-
zip
public <S> LazyIterable<Pair<T,S>> zip(java.lang.Iterable<S> that)
Description copied from interface:LazyIterableCreates a deferred zip iterable.- Specified by:
zipin interfaceLazyIterable<T>- Specified by:
zipin interfaceRichIterable<T>- Type Parameters:
S- the type of the second half of the returned pairs- Parameters:
that- TheRichIterableproviding the second half of each result pair- Returns:
- A new
RichIterablecontaining pairs consisting of corresponding elements of thisRichIterableand that. The length of the returnedRichIterableis the minimum of the lengths of thisRichIterableand that.
-
zipWithIndex
public LazyIterable<Pair<T,java.lang.Integer>> zipWithIndex()
Description copied from interface:LazyIterableCreates a deferred zipWithIndex iterable.- Specified by:
zipWithIndexin interfaceLazyIterable<T>- Specified by:
zipWithIndexin interfaceRichIterable<T>- Returns:
- A new
RichIterablecontaining pairs consisting of all elements of thisRichIterablepaired with their index. Indices start at 0. - See Also:
RichIterable.zip(Iterable)
-
chunk
public LazyIterable<RichIterable<T>> chunk(int size)
Description copied from interface:LazyIterableCreates a deferred chunk iterable.- Specified by:
chunkin interfaceLazyIterable<T>- Specified by:
chunkin interfaceRichIterable<T>- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingRichIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
tap
public LazyIterable<T> tap(Procedure<? super T> procedure)
Description copied from interface:LazyIterableCreates a deferred tap iterable.- Specified by:
tapin interfaceLazyIterable<T>- Specified by:
tapin interfaceRichIterable<T>- See Also:
RichIterable.each(Procedure),RichIterable.forEach(Procedure)
-
sumByInt
public <V> ObjectLongMap<V> sumByInt(Function<? super T,? extends V> groupBy, IntFunction<? super T> function)
Description copied from interface:RichIterableGroups and sums the values using the two specified functions.- Specified by:
sumByIntin interfaceRichIterable<T>
-
sumByFloat
public <V> ObjectDoubleMap<V> sumByFloat(Function<? super T,? extends V> groupBy, FloatFunction<? super T> function)
Description copied from interface:RichIterableGroups and sums the values using the two specified functions.- Specified by:
sumByFloatin interfaceRichIterable<T>
-
sumByLong
public <V> ObjectLongMap<V> sumByLong(Function<? super T,? extends V> groupBy, LongFunction<? super T> function)
Description copied from interface:RichIterableGroups and sums the values using the two specified functions.- Specified by:
sumByLongin interfaceRichIterable<T>
-
sumByDouble
public <V> ObjectDoubleMap<V> sumByDouble(Function<? super T,? extends V> groupBy, DoubleFunction<? super T> function)
Description copied from interface:RichIterableGroups and sums the values using the two specified functions.- Specified by:
sumByDoublein interfaceRichIterable<T>
-
minOptional
public java.util.Optional<T> minOptional(java.util.Comparator<? super T> comparator)
Description copied from interface:RichIterableReturns the minimum element out of this container based on the comparator as an Optional. If the container is emptyOptional.empty()is returned.- Specified by:
minOptionalin interfaceRichIterable<T>
-
maxOptional
public java.util.Optional<T> maxOptional(java.util.Comparator<? super T> comparator)
Description copied from interface:RichIterableReturns the maximum element out of this container based on the comparator as an Optional. If the container is emptyOptional.empty()is returned.- Specified by:
maxOptionalin interfaceRichIterable<T>
-
minOptional
public java.util.Optional<T> minOptional()
Description copied from interface:RichIterableReturns the minimum element out of this container based on the natural order as an Optional. If the container is emptyOptional.empty()is returned.- Specified by:
minOptionalin interfaceRichIterable<T>
-
maxOptional
public java.util.Optional<T> maxOptional()
Description copied from interface:RichIterableReturns the maximum element out of this container based on the natural order as an Optional. If the container is emptyOptional.empty()is returned.- Specified by:
maxOptionalin interfaceRichIterable<T>
-
minByOptional
public <V extends java.lang.Comparable<? super V>> java.util.Optional<T> minByOptional(Function<? super T,? extends V> function)
Description copied from interface:RichIterableReturns the minimum elements out of this container based on the natural order of the attribute returned by Function as an Optional. If the container is emptyOptional.empty()is returned.- Specified by:
minByOptionalin interfaceRichIterable<T>
-
maxByOptional
public <V extends java.lang.Comparable<? super V>> java.util.Optional<T> maxByOptional(Function<? super T,? extends V> function)
Description copied from interface:RichIterableReturns the maximum elements out of this container based on the natural order of the attribute returned by Function as an Optional. If the container is emptyOptional.empty()is returned.- Specified by:
maxByOptionalin interfaceRichIterable<T>
-
-