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