org.fest.util
Class Iterables

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

public final class Iterables
extends Object

Utility methods related to Iterables.

Author:
Yvonne Wang, Alex Ruiz, Joel Costigliola

Method Summary
static boolean isNullOrEmpty(Iterable<?> iterable)
          Indicates whether the given Iterable is null or empty.
static
<T> List<T>
nonNullElementsIn(Iterable<T> i)
          Returns all the non-null elements in the given Iterable.
static int sizeOf(Iterable<?> iterable)
          Returns the size of the given Iterable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.