Class AbstractLazyIterable<T>

java.lang.Object
org.eclipse.collections.impl.AbstractRichIterable<T>
org.eclipse.collections.impl.lazy.AbstractLazyIterable<T>
All Implemented Interfaces:
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 Details

    • AbstractLazyIterable

      public AbstractLazyIterable()
  • Method Details

    • asLazy

      public LazyIterable<T> asLazy()
      Description copied from interface: RichIterable
      Returns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).
      Specified by:
      asLazy in interface RichIterable<T>
      Overrides:
      asLazy in class AbstractRichIterable<T>
    • into

      public <R extends Collection<T>> R into(R target)
      Description copied from interface: RichIterable
      Adds all the elements in this iterable to the specific target Collection.
      Specified by:
      into in interface LazyIterable<T>
      Specified by:
      into in interface RichIterable<T>
      Overrides:
      into in class AbstractRichIterable<T>
    • size

      public int size()
      Description copied from interface: RichIterable
      Returns the number of items in this iterable.
      Specified by:
      size in interface RichIterable<T>
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: RichIterable
      Returns true if this iterable has zero items.
      Specified by:
      isEmpty in interface RichIterable<T>
      Overrides:
      isEmpty in class AbstractRichIterable<T>
    • getFirst

      public T getFirst()
      Description copied from interface: RichIterable
      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.

      Specified by:
      getFirst in interface LazyIterable<T>
      Specified by:
      getFirst in interface RichIterable<T>
    • getLast

      public T getLast()
      Description copied from interface: RichIterable
      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.

      Specified by:
      getLast in interface RichIterable<T>
    • getOnly

      public T getOnly()
      Description copied from interface: RichIterable
      Returns the element if the iterable has exactly one element. Otherwise, throw IllegalStateException.
      Specified by:
      getOnly in interface RichIterable<T>
      Returns:
      an element of an iterable.
    • select

      public LazyIterable<T> select(Predicate<? super T> predicate)
      Description copied from interface: RichIterable
      Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter.

      Example using a Java 8 lambda expression:

      RichIterable<Person> selected =
          people.select(person -> person.getAddress().getCity().equals("London"));
      
      Specified by:
      select in interface LazyIterable<T>
      Specified by:
      select in interface RichIterable<T>
    • selectWith

      public <P> LazyIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
      Description copied from interface: RichIterable
      Similar to 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));
      
      Specified by:
      selectWith in interface LazyIterable<T>
      Specified by:
      selectWith in interface RichIterable<T>
      Parameters:
      predicate - a Predicate2 to use as the select criteria
      parameter - a parameter to pass in for evaluation of the second argument P in predicate
      See Also:
    • reject

      public LazyIterable<T> reject(Predicate<? super T> predicate)
      Description copied from interface: RichIterable
      Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)).

      Example using a Java 8 lambda expression:

      RichIterable<Person> rejected =
          people.reject(person -> person.person.getLastName().equals("Smith"));
      
      Specified by:
      reject in interface LazyIterable<T>
      Specified by:
      reject in interface RichIterable<T>
      Parameters:
      predicate - a Predicate to 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: RichIterable
      Similar to 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));
      
      Specified by:
      rejectWith in interface LazyIterable<T>
      Specified by:
      rejectWith in interface RichIterable<T>
      Parameters:
      predicate - a Predicate2 to use as the select criteria
      parameter - a parameter to pass in for evaluation of the second argument P in predicate
      See Also:
    • partition

      public PartitionMutableList<T> partition(Predicate<? super T> predicate)
      Description copied from interface: RichIterable
      Filters 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:
      partition in interface RichIterable<T>
    • partitionWith

      public <P> PartitionMutableList<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
      Description copied from interface: RichIterable
      Filters 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:
      partitionWith in interface RichIterable<T>
    • selectInstancesOf

      public <S> LazyIterable<S> selectInstancesOf(Class<S> clazz)
      Description copied from interface: RichIterable
      Returns all elements of the source collection that are instances of the Class clazz.
      RichIterable<Integer> integers =
          List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
      
      Specified by:
      selectInstancesOf in interface LazyIterable<T>
      Specified by:
      selectInstancesOf in interface RichIterable<T>
    • collect

      public <V> LazyIterable<V> collect(Function<? super T, ? extends V> function)
      Description copied from interface: RichIterable
      Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      RichIterable<String> names =
          people.collect(person -> person.getFirstName() + " " + person.getLastName());
      
      Specified by:
      collect in interface LazyIterable<T>
      Specified by:
      collect in interface RichIterable<T>
    • collectBoolean

      public LazyBooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction)
      Description copied from interface: RichIterable
      Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      BooleanIterable licenses =
          people.collectBoolean(person -> person.hasDrivingLicense());
      
      Specified by:
      collectBoolean in interface LazyIterable<T>
      Specified by:
      collectBoolean in interface RichIterable<T>
    • collectByte

      public LazyByteIterable collectByte(ByteFunction<? super T> byteFunction)
      Description copied from interface: RichIterable
      Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      ByteIterable bytes =
          people.collectByte(person -> person.getCode());
      
      Specified by:
      collectByte in interface LazyIterable<T>
      Specified by:
      collectByte in interface RichIterable<T>
    • collectChar

      public LazyCharIterable collectChar(CharFunction<? super T> charFunction)
      Description copied from interface: RichIterable
      Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      CharIterable chars =
          people.collectChar(person -> person.getMiddleInitial());
      
      Specified by:
      collectChar in interface LazyIterable<T>
      Specified by:
      collectChar in interface RichIterable<T>
    • collectDouble

      public LazyDoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction)
      Description copied from interface: RichIterable
      Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      DoubleIterable doubles =
          people.collectDouble(person -> person.getMilesFromNorthPole());
      
      Specified by:
      collectDouble in interface LazyIterable<T>
      Specified by:
      collectDouble in interface RichIterable<T>
    • collectFloat

      public LazyFloatIterable collectFloat(FloatFunction<? super T> floatFunction)
      Description copied from interface: RichIterable
      Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      FloatIterable floats =
          people.collectFloat(person -> person.getHeightInInches());
      
      Specified by:
      collectFloat in interface LazyIterable<T>
      Specified by:
      collectFloat in interface RichIterable<T>
    • collectInt

      public LazyIntIterable collectInt(IntFunction<? super T> intFunction)
      Description copied from interface: RichIterable
      Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      IntIterable ints =
          people.collectInt(person -> person.getAge());
      
      Specified by:
      collectInt in interface LazyIterable<T>
      Specified by:
      collectInt in interface RichIterable<T>
    • collectLong

      public LazyLongIterable collectLong(LongFunction<? super T> longFunction)
      Description copied from interface: RichIterable
      Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      LongIterable longs =
          people.collectLong(person -> person.getGuid());
      
      Specified by:
      collectLong in interface LazyIterable<T>
      Specified by:
      collectLong in interface RichIterable<T>
    • collectShort

      public LazyShortIterable collectShort(ShortFunction<? super T> shortFunction)
      Description copied from interface: RichIterable
      Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

      Example using a Java 8 lambda expression:

      ShortIterable shorts =
          people.collectShort(person -> person.getNumberOfJunkMailItemsReceivedPerMonth());
      
      Specified by:
      collectShort in interface LazyIterable<T>
      Specified by:
      collectShort in interface RichIterable<T>
    • collectWith

      public <P,V> LazyIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
      Description copied from interface: RichIterable
      Same as 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));
      
      Specified by:
      collectWith in interface LazyIterable<T>
      Specified by:
      collectWith in interface RichIterable<T>
      Parameters:
      function - A Function2 to use as the collect transformation function
      parameter - A parameter to pass in for evaluation of the second argument P in function
      Returns:
      A new RichIterable that contains the transformed elements returned by Function2.value(Object, Object)
      See Also:
    • flatCollect

      public <V> LazyIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)
      Description copied from interface: RichIterable
      flatCollect is a special case of RichIterable.collect(Function). With collect, when the Function returns a collection, the result is a collection of collections. flatCollect outputs a single "flattened" collection instead. This method is commonly called flatMap.

      Consider the following example where we have a Person class, and each Person has a list of Address objects. Take the following Function:

      Function<Person, List<Address>> addressFunction = Person::getAddresses;
      RichIterable<Person> people = ...;
      
      Using collect returns a collection of collections of addresses.
      RichIterable<List<Address>> addresses = people.collect(addressFunction);
      
      Using flatCollect returns a single flattened list of addresses.
      RichIterable<Address> addresses = people.flatCollect(addressFunction);
      
      Specified by:
      flatCollect in interface LazyIterable<T>
      Specified by:
      flatCollect in interface RichIterable<T>
      Parameters:
      function - The Function to apply
      Returns:
      a new flattened collection produced by applying the given function
    • concatenate

      public LazyIterable<T> concatenate(Iterable<T> iterable)
      Description copied from interface: LazyIterable
      Creates a deferred iterable that will join this iterable with the specified iterable.
      Specified by:
      concatenate in interface LazyIterable<T>
    • collectIf

      public <V> LazyIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
      Description copied from interface: RichIterable
      Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. This is the optimized equivalent of calling iterable.select(predicate).collect(function).

      Example using a Java 8 lambda and method reference:

      RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString);
      

      Example using Predicates factory:

      RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
      
      Specified by:
      collectIf in interface LazyIterable<T>
      Specified by:
      collectIf in interface RichIterable<T>
    • take

      public LazyIterable<T> take(int count)
      Description copied from interface: LazyIterable
      Creates a deferred take iterable for the current iterable using the specified count as the limit.
      Specified by:
      take in interface LazyIterable<T>
    • drop

      public LazyIterable<T> drop(int count)
      Description copied from interface: LazyIterable
      Creates a deferred drop iterable for the current iterable using the specified count as the limit.
      Specified by:
      drop in interface LazyIterable<T>
    • takeWhile

      public LazyIterable<T> takeWhile(Predicate<? super T> predicate)
      Specified by:
      takeWhile in interface LazyIterable<T>
      See Also:
    • dropWhile

      public LazyIterable<T> dropWhile(Predicate<? super T> predicate)
      Specified by:
      dropWhile in interface LazyIterable<T>
      See Also:
    • distinct

      public LazyIterable<T> distinct()
      Description copied from interface: LazyIterable
      Creates a deferred distinct iterable to get distinct elements from the current iterable.
      Specified by:
      distinct in interface LazyIterable<T>
    • toStack

      public MutableStack<T> toStack()
    • groupBy

      public <V> Multimap<V,T> groupBy(Function<? super T, ? extends V> function)
      Description copied from interface: RichIterable
      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.

      Example using a Java 8 method reference:

      Multimap<String, Person> peopleByLastName =
          people.groupBy(Person::getLastName);
      
      Specified by:
      groupBy in interface RichIterable<T>
    • groupByEach

      public <V> Multimap<V,T> groupByEach(Function<? super T, ? extends Iterable<V>> function)
      Description copied from interface: RichIterable
      Similar to RichIterable.groupBy(Function), except the result of evaluating function will return a collection of keys for each value.
      Specified by:
      groupByEach in interface RichIterable<T>
    • groupByUniqueKey

      public <V> MapIterable<V,T> groupByUniqueKey(Function<? super T, ? extends V> function)
      Description copied from interface: RichIterable
      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. The generated keys must each be unique, or else an exception is thrown.
      Specified by:
      groupByUniqueKey in interface RichIterable<T>
      See Also:
    • zip

      public <S> LazyIterable<Pair<T,S>> zip(Iterable<S> that)
      Description copied from interface: RichIterable
      Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs. If one of the two RichIterables is longer than the other, its remaining elements are ignored.
      Specified by:
      zip in interface LazyIterable<T>
      Specified by:
      zip in interface RichIterable<T>
      Type Parameters:
      S - the type of the second half of the returned pairs
      Parameters:
      that - The RichIterable providing the second half of each result pair
      Returns:
      A new RichIterable 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.
    • zipWithIndex

      public LazyIterable<Pair<T,Integer>> zipWithIndex()
      Description copied from interface: RichIterable
      Zips this RichIterable with its indices.
      Specified by:
      zipWithIndex in interface LazyIterable<T>
      Specified by:
      zipWithIndex in interface RichIterable<T>
      Returns:
      A new RichIterable containing pairs consisting of all elements of this RichIterable paired with their index. Indices start at 0.
      See Also:
    • chunk

      public LazyIterable<RichIterable<T>> chunk(int size)
      Description copied from interface: RichIterable
      Partitions elements in fixed size chunks.
      Specified by:
      chunk in interface LazyIterable<T>
      Specified by:
      chunk in interface RichIterable<T>
      Parameters:
      size - the number of elements per chunk
      Returns:
      A RichIterable containing RichIterables of size size, 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: RichIterable
      Executes the Procedure for each element in the iterable and returns this.

      Example using a Java 8 lambda expression:

      RichIterable<Person> tapped =
          people.tap(person -> LOGGER.info(person.getName()));
      
      Specified by:
      tap in interface LazyIterable<T>
      Specified by:
      tap in interface RichIterable<T>
      See Also:
    • sumByInt

      public <V> ObjectLongMap<V> sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)
      Description copied from interface: RichIterable
      Groups and sums the values using the two specified functions.
      Specified by:
      sumByInt in interface RichIterable<T>
    • sumByFloat

      public <V> ObjectDoubleMap<V> sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)
      Description copied from interface: RichIterable
      Groups and sums the values using the two specified functions.
      Specified by:
      sumByFloat in interface RichIterable<T>
    • sumByLong

      public <V> ObjectLongMap<V> sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)
      Description copied from interface: RichIterable
      Groups and sums the values using the two specified functions.
      Specified by:
      sumByLong in interface RichIterable<T>
    • sumByDouble

      public <V> ObjectDoubleMap<V> sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)
      Description copied from interface: RichIterable
      Groups and sums the values using the two specified functions.
      Specified by:
      sumByDouble in interface RichIterable<T>
    • minOptional

      public Optional<T> minOptional(Comparator<? super T> comparator)
      Description copied from interface: RichIterable
      Returns the minimum element out of this container based on the comparator as an Optional. If the container is empty Optional.empty() is returned.
      Specified by:
      minOptional in interface RichIterable<T>
    • maxOptional

      public Optional<T> maxOptional(Comparator<? super T> comparator)
      Description copied from interface: RichIterable
      Returns the maximum element out of this container based on the comparator as an Optional. If the container is empty Optional.empty() is returned.
      Specified by:
      maxOptional in interface RichIterable<T>
    • minOptional

      public Optional<T> minOptional()
      Description copied from interface: RichIterable
      Returns the minimum element out of this container based on the natural order as an Optional. If the container is empty Optional.empty() is returned.
      Specified by:
      minOptional in interface RichIterable<T>
    • maxOptional

      public Optional<T> maxOptional()
      Description copied from interface: RichIterable
      Returns the maximum element out of this container based on the natural order as an Optional. If the container is empty Optional.empty() is returned.
      Specified by:
      maxOptional in interface RichIterable<T>
    • minByOptional

      public <V extends Comparable<? super V>> Optional<T> minByOptional(Function<? super T, ? extends V> function)
      Description copied from interface: RichIterable
      Returns 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 empty Optional.empty() is returned.
      Specified by:
      minByOptional in interface RichIterable<T>
    • maxByOptional

      public <V extends Comparable<? super V>> Optional<T> maxByOptional(Function<? super T, ? extends V> function)
      Description copied from interface: RichIterable
      Returns 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 empty Optional.empty() is returned.
      Specified by:
      maxByOptional in interface RichIterable<T>