Package org.fest.util
Class Iterables
- java.lang.Object
-
- org.fest.util.Iterables
-
public final class Iterables extends java.lang.ObjectUtility methods related toIterables.- Author:
- Yvonne Wang, Alex Ruiz, Joel Costigliola
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisNullOrEmpty(java.lang.Iterable<?> iterable)Indicates whether the givenIterableisnullor empty.static <T> java.util.List<T>nonNullElementsIn(java.lang.Iterable<T> i)Returns all the non-nullelements in the givenIterable.static intsizeOf(java.lang.Iterable<?> iterable)Returns the size of the givenIterable.
-
-
-
Method Detail
-
isNullOrEmpty
public static boolean isNullOrEmpty(java.lang.Iterable<?> iterable)
Indicates whether the givenIterableisnullor empty.- Parameters:
iterable- the givenIterableto check.- Returns:
trueif the givenIterableisnullor empty, otherwisefalse.
-
sizeOf
public static int sizeOf(java.lang.Iterable<?> iterable)
Returns the size of the givenIterable.- Parameters:
iterable- theIterableto get size.- Returns:
- the size of the given
Iterable. - Throws:
java.lang.NullPointerException- if givenIterableis null.
-
nonNullElementsIn
public static <T> java.util.List<T> nonNullElementsIn(java.lang.Iterable<T> i)
Returns all the non-nullelements in the givenIterable.- Type Parameters:
T- the type of elements of theIterable.- Parameters:
i- the givenIterable.- Returns:
- all the non-
nullelements in the givenIterable. An empty list is returned if the givenIterableisnull. - Since:
- 1.1.3
-
-