Class Iterables


  • public class Iterables
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Iterables()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean allElementsAreEqual​(java.lang.Iterable<?> left, java.lang.Iterable<?> right)  
      static <T> java.lang.Iterable<T> concat​(java.lang.Iterable<T>... inputs)  
      static <T> java.lang.Iterable<T> flatten​(java.lang.Iterable<? extends java.lang.Iterable<T>> inputs)
      Flattens the two level Iterable into a single Iterable.
      static <T> T get​(java.lang.Iterable<T> iterable, int position)  
      static <T> T getFirst​(java.lang.Iterable<T> collection, T defaultValue)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Iterables

        public Iterables()
    • Method Detail

      • concat

        public static <T> java.lang.Iterable<T> concat​(java.lang.Iterable<T>... inputs)
      • flatten

        public static <T> java.lang.Iterable<T> flatten​(java.lang.Iterable<? extends java.lang.Iterable<T>> inputs)
        Flattens the two level Iterable into a single Iterable. Note that this pre-caches the values from the outer Iterable, but not the values from the inner one.
      • allElementsAreEqual

        public static boolean allElementsAreEqual​(java.lang.Iterable<?> left,
                                                  java.lang.Iterable<?> right)
      • getFirst

        public static <T> T getFirst​(java.lang.Iterable<T> collection,
                                     T defaultValue)
      • get

        public static <T> T get​(java.lang.Iterable<T> iterable,
                                int position)