Class CompositeIterable<T>

  • All Implemented Interfaces:
    java.lang.Iterable<T>

    public class CompositeIterable<T>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    Used for iterating over an series of iterables, thus avoiding the need to allocate/populate a new list containing all elements. More efficient than the alternative when the number of iterables is arbitrary and small relative to the size of each iterable.
    Author:
    Paul Ferraro
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositeIterable​(java.lang.Iterable<? extends T>... iterables)
      Constructs a new composite iterable.
      CompositeIterable​(java.util.List<? extends java.lang.Iterable<? extends T>> iterables)
      Constructs a new composite iterable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)  
      int hashCode()  
      java.util.Iterator<T> iterator()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

        forEach, spliterator
    • Constructor Detail

      • CompositeIterable

        @SafeVarargs
        public CompositeIterable​(java.lang.Iterable<? extends T>... iterables)
        Constructs a new composite iterable.
        Parameters:
        iterables - a series of iterables
      • CompositeIterable

        public CompositeIterable​(java.util.List<? extends java.lang.Iterable<? extends T>> iterables)
        Constructs a new composite iterable.
        Parameters:
        iterables - a series of iterables
    • Method Detail

      • iterator

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

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • toString

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