Class Iterables


  • public final class Iterables
    extends java.lang.Object
    Utility method around Iterables and Iterators.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.lang.Iterable<T> filter​(java.lang.Iterable<? extends T> delegate, Predicate<? super T> predicate)  
      static <T> java.util.Iterator<T> filter​(java.util.Iterator<? extends T> delegate, Predicate<? super T> predicate)  
      static <T> java.lang.Iterable<T> filter​(T[] delegate, Predicate<? super T> predicate)  
      static <T> java.lang.Iterable<T> filterByClass​(java.lang.Iterable<?> delegate, java.lang.Class<T> qualifyingClass)  
      static <T> java.lang.Iterable<T> filterByClass​(java.lang.Object[] delegate, java.lang.Class<T> qualifyingClass)  
      static <T> java.util.Iterator<T> filterByClass​(java.util.Iterator<?> delegate, java.lang.Class<T> qualifyingClass)  
      static <T> T[] toArray​(java.lang.Iterable<T> delegate, java.lang.Class<T> elementType)  
      static <T> T[] toArray​(java.util.Iterator<T> delegate, java.lang.Class<T> componentType)  
      • Methods inherited from class java.lang.Object

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

      • filterByClass

        public static <T> java.lang.Iterable<T> filterByClass​(java.lang.Object[] delegate,
                                                              java.lang.Class<T> qualifyingClass)
        Returns:
        An Iterable that filters the delegate's elements by base class
      • filterByClass

        public static <T> java.lang.Iterable<T> filterByClass​(java.lang.Iterable<?> delegate,
                                                              java.lang.Class<T> qualifyingClass)
        Returns:
        An Iterable that filters the delegate's elements by base class
      • filterByClass

        public static <T> java.util.Iterator<T> filterByClass​(java.util.Iterator<?> delegate,
                                                              java.lang.Class<T> qualifyingClass)
        Returns:
        An Iterator that filters the delegate's products by base class
      • filter

        public static <T> java.lang.Iterable<T> filter​(T[] delegate,
                                                       Predicate<? super T> predicate)
        Returns:
        An Iterable that discriminates the delegate's elements with the predicate
      • filter

        public static <T> java.lang.Iterable<T> filter​(java.lang.Iterable<? extends T> delegate,
                                                       Predicate<? super T> predicate)
        Returns:
        An Iterable that discriminates the delegate's elements with the predicate
      • filter

        public static <T> java.util.Iterator<T> filter​(java.util.Iterator<? extends T> delegate,
                                                       Predicate<? super T> predicate)
        Returns:
        An Iterator that discriminates the delegate's products with the predicate
      • toArray

        public static <T> T[] toArray​(java.lang.Iterable<T> delegate,
                                      java.lang.Class<T> elementType)
        Returns:
        All elements of the delegate
      • toArray

        public static <T> T[] toArray​(java.util.Iterator<T> delegate,
                                      java.lang.Class<T> componentType)
        Returns:
        All products of the delegate