Package org.cactoos.iterator
Class Filtered<X>
- java.lang.Object
-
- org.cactoos.iterator.Filtered<X>
-
- Type Parameters:
X
- Type of item
- All Implemented Interfaces:
Iterator<X>
public final class Filtered<X> extends Object implements Iterator<X>
Filtered iterator.You can use it in order to create a declarative/lazy version of a filtered collection/iterable. For example, this code will create a list of two strings "hello" and "world":
Iterator<String> list = new Filtered<>( new ArrayOf<>( "hey", "hello", "world" ).iterator(), input -> input.length() > 4 );
There is no thread-safety guarantee.
- Since:
- 0.1
- See Also:
Filtered
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
X
next()
void
remove()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-