Class LazyIterablesConcatenator<T>

  • Type Parameters:
    T - Type of element being iterared
    All Implemented Interfaces:
    java.lang.Iterable<T>

    public class LazyIterablesConcatenator<T>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    Creates a "smooth" wrapping Iterable using several underlying ones to provide the values. The "lazy" denomination is due to the fact that no iterable is consulted until the one(s) before it have been fully exhausted.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables  
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyIterablesConcatenator​(java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Iterable<? extends java.lang.Iterable<? extends T>> getIterables()  
      java.util.Iterator<T> iterator()  
      static <T> java.lang.Iterable<T> lazyConcatenateIterables​(java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • iterables

        private final java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables
    • Constructor Detail

      • LazyIterablesConcatenator

        public LazyIterablesConcatenator​(java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)
    • Method Detail

      • getIterables

        public java.lang.Iterable<? extends java.lang.Iterable<? extends T>> getIterables()
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • lazyConcatenateIterables

        public static <T> java.lang.Iterable<T> lazyConcatenateIterables​(java.lang.Iterable<? extends java.lang.Iterable<? extends T>> iterables)
        Type Parameters:
        T - Type if iterated element
        Parameters:
        iterables - The iterables to concatenate - ignored if null
        Returns:
        An Iterable that goes over all the elements in the wrapped iterables one after the other. The denomination "lazy" indicates that no iterable is consulted until the previous one has been fully exhausted.