de.caff.generics

## Class ConcatenatedIterables<T>

- java.lang.Object
- - de.caff.generics.ConcatenatedIterables<T>

- Type Parameters:
    `T` - type of iterator
  All Implemented Interfaces:
    java.lang.Iterable<T>

      public class ConcatenatedIterables<T>
      extends java.lang.Object
      implements java.lang.Iterable<T>

  Concatenated iterables.

  This allows to iterate over several iterables one after the other in one iteration. It just provides a view and does no additional copying.

  This class is not thread-safe!

  Since:
    August.04, 2016
  Author:
    Rammi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConcatenatedIterables(java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)` Constructor.
    `ConcatenatedIterables(java.lang.Iterable<? extends T>... iterables)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <U> ConcatenatedIterables<U>` | `flatten2(java.lang.Iterable<? extends java.lang.Iterable<? extends java.lang.Iterable<U>>> iterables)` Flatten iterables 2 levels deep.
    `java.util.Iterator<T>` | `iterator()` Returns an iterator over a set of elements of type T.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### ConcatenatedIterables

          @SafeVarargs
          public ConcatenatedIterables(java.lang.Iterable<? extends T>... iterables)

      Constructor.
      Parameters:
        `iterables` - iterables to iterate over
      See Also:
        `Types.concat(Iterable[])`

    - #### ConcatenatedIterables

          public ConcatenatedIterables(@NotNull
                                       java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)

      Constructor.
      Parameters:
        `iterables` - iterators to iterate over
      See Also:
        `Types.concatIterables(Iterable)`

  - ### Method Detail

    - #### iterator

          @NotNull
          public java.util.Iterator<T> iterator()

      Returns an iterator over a set of elements of type T.
      Specified by:
        `iterator` in interface `java.lang.Iterable<T>`
      Returns:
        an Iterator.

    - #### flatten2

          @NotNull
          public static <U> ConcatenatedIterables<U> flatten2(@NotNull
                                                                       java.lang.Iterable<? extends java.lang.Iterable<? extends java.lang.Iterable<U>>> iterables)

      Flatten iterables 2 levels deep.
      Type Parameters:
        `U` - iterator value type
      Parameters:
        `iterables` - iterables to flatten
      Returns:
        concatenation of all iterables in depth 2