T
- The base type of the iterablepublic class TypedIterable<T> extends Object implements Iterable<T>, HasWrappedIterable
Constructor and Description |
---|
TypedIterable(Class<T> type,
Iterable<?> iterable)
Creates a new
TypedIterable instance. |
TypedIterable(Iterable<T> iterable,
Class<T> type)
Creates a new
TypedIterable instance. |
Modifier and Type | Method and Description |
---|---|
T |
first()
Returns the first item of this iterable.
|
Class<T> |
getType()
Returns the base type of this iterable.
|
Iterable<?> |
getWrappedIterable()
Returns the backing iterable.
|
boolean |
isEmpty()
Returns a flag that indicates whether this iterable is empty.
|
Iterator<T> |
iterator()
Returns an iterator for this iterable.
|
public TypedIterable(Iterable<T> iterable, Class<T> type)
TypedIterable
instance.iterable
- The backing iterabletype
- The base type of the iterablepublic TypedIterable(Class<T> type, Iterable<?> iterable)
TypedIterable
instance. Performs a cast on each item to make sure that the elements
to the backing iterable conform to the specified type.type
- The base type of the iterableiterable
- The backing iterablepublic Class<T> getType()
public Iterable<?> getWrappedIterable()
getWrappedIterable
in interface HasWrappedIterable
public T first()
public boolean isEmpty()
true
if this iterable contains no elements; false
otherwiseCopyright © 2013. All Rights Reserved.