T - The type of the iterable’s elementspublic class IterableWrapper<T> extends Object implements Iterable<T>
FilteredIterable,
MappedIterable| Constructor and Description |
|---|
IterableWrapper(Iterable<T> iterable)
Creates a new iterable wrapper.
|
| Modifier and Type | Method and Description |
|---|---|
Collection<T> |
collection()
Returns all elements contained in the wrapped iterable as a new
Collection. |
static <T> IterableWrapper<T> |
emptyIterable()
Creates a new iterable wrapper that returns iterators that do not return
any elements.
|
IterableWrapper<T> |
filter(Filter<? super T> filter)
Creates a new wrapper around the iterable that will have its elements
filtered by the given filter.
|
T |
get()
Returns the first element of an iterator created by the wrapped iterable.
|
T |
get(T defaultValue)
Returns the first element of an iterator created by the wrapped iterable,
or the given default value if the iterator does not contain any elements.
|
boolean |
isEmpty()
Checks whether the wrapped iterable contains at least one element.
|
Iterator<T> |
iterator() |
List<T> |
list()
Returns all elements contained in the wrapped iterable as a new
List. |
<O> IterableWrapper<O> |
map(Mapper<? super T,? extends O> mapper)
Creates a new wrapper around the iterable that will have its elements
mapped by the given mapper.
|
IterableWrapper<T> |
process(Processor<? super T> processor)
Creates a new wrapper around the iterable that will have its elements
processed by the given processor.
|
static <T> IterableWrapper<T> |
wrap(Iterable<T> iterable)
Convenience method that creates a new
IterableWrapper around the
given iterable. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic IterableWrapper<T> filter(Filter<? super T> filter)
map(Mapper), or process(Processor)) which performs more
than one operation on its iterators.filter - The filter to applypublic <O> IterableWrapper<O> map(Mapper<? super T,? extends O> mapper)
filter(Filter), or process(Processor)) which performs
more than one operation on its iterators.O - The type of the mapped elementsmapper - The mapper to applypublic IterableWrapper<T> process(Processor<? super T> processor)
filter(Filter) or map(Mapper)) which performs more than
one operation on its iterators.processor - The processor to apply to all returned elementspublic boolean isEmpty()
true if the wrapped iterable produces iterators without
any elements in thempublic T get() throws NoSuchElementException
NoSuchElementException - if the wrapped iterable’s iterator does not produce any
objectspublic T get(T defaultValue)
defaultValue - The value to return if the wrapped iterable does not contain
any elementspublic Collection<T> collection()
Collection. The returned collection is a snapshot, i.e.
modifications to the underlying Iterables of this wrapper will
not modify the returned collection.public List<T> list()
List. The returned collection is a snapshot, i.e. modifications
to the underlying Iterables of this wrapper will not modify the
returned list.public static <T> IterableWrapper<T> emptyIterable()
T - The type of the elements to (not) returnpublic static <T> IterableWrapper<T> wrap(Iterable<T> iterable)
IterableWrapper around the
given iterable.iterable - The iterable to wrapCopyright © 2026. All rights reserved.