Class Iterables


  • public final class Iterables
    extends java.lang.Object
    Utilities for Iterables
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Iterables()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T firstOf​(java.lang.Iterable<T> iterable)
      Returns first element of provided iterable or fails fast when iterable is empty.
      static <T> java.lang.Iterable<T> toIterable​(java.util.Enumeration<T> in)
      Converts enumeration into iterable
      • Methods inherited from class java.lang.Object

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

      • Iterables

        private Iterables()
    • Method Detail

      • toIterable

        public static <T> java.lang.Iterable<T> toIterable​(java.util.Enumeration<T> in)
        Converts enumeration into iterable
      • firstOf

        public static <T> T firstOf​(java.lang.Iterable<T> iterable)
        Returns first element of provided iterable or fails fast when iterable is empty.
        Parameters:
        iterable - non-empty iterable
        Returns:
        first element of supplied iterable
        Throws:
        java.lang.IllegalArgumentException - when supplied iterable is empty