Package org.fest.util

Class Iterables

java.lang.Object
org.fest.util.Iterables

public final class Iterables extends Object
Utility methods related to Iterables.
Author:
Yvonne Wang, Alex Ruiz, Joel Costigliola
  • Method Details

    • isNullOrEmpty

      public static boolean isNullOrEmpty(Iterable<?> iterable)
      Indicates whether the given Iterable is null or empty.
      Parameters:
      iterable - the given Iterable to check.
      Returns:
      true if the given Iterable is null or empty, otherwise false.
    • sizeOf

      public static int sizeOf(Iterable<?> iterable)
      Returns the size of the given Iterable.
      Parameters:
      iterable - the Iterable to get size.
      Returns:
      the size of the given Iterable.
      Throws:
      NullPointerException - if given Iterable is null.
    • nonNullElementsIn

      public static <T> List<T> nonNullElementsIn(Iterable<T> i)
      Returns all the non-null elements in the given Iterable.
      Type Parameters:
      T - the type of elements of the Iterable.
      Parameters:
      i - the given Iterable.
      Returns:
      all the non-null elements in the given Iterable. An empty list is returned if the given Iterable is null.
      Since:
      1.1.3