java.lang.Object
org.codehaus.commons.compiler.util.iterator.Iterables

public final class Iterables extends Object
Utility method around Iterables and Iterators.
  • Constructor Details

    • Iterables

      private Iterables()
  • Method Details

    • filterByClass

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

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

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

      public static <T> 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> Iterable<T> filter(Iterable<? extends T> delegate, Predicate<? super T> predicate)
      Returns:
      An Iterable that discriminates the delegate's elements with the predicate
    • filter

      public static <T> Iterator<T> filter(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(Iterable<T> delegate, Class<T> elementType)
      Returns:
      All elements of the delegate
    • toArray

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