Package org.fest.util
Class Iterables
java.lang.Object
org.fest.util.Iterables
Utility methods related to
Iterable
s.- Author:
- Yvonne Wang, Alex Ruiz, Joel Costigliola
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isNullOrEmpty
(Iterable<?> iterable) Indicates whether the givenIterable
isnull
or empty.static <T> List<T>
nonNullElementsIn
(Iterable<T> i) Returns all the non-null
elements in the givenIterable
.static int
Returns the size of the givenIterable
.
-
Method Details
-
isNullOrEmpty
Indicates whether the givenIterable
isnull
or empty.- Parameters:
iterable
- the givenIterable
to check.- Returns:
true
if the givenIterable
isnull
or empty, otherwisefalse
.
-
sizeOf
Returns the size of the givenIterable
.- Parameters:
iterable
- theIterable
to get size.- Returns:
- the size of the given
Iterable
. - Throws:
NullPointerException
- if givenIterable
is null.
-
nonNullElementsIn
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
-