Class PropertyIterator
java.lang.Object
net.okapia.osid.torrefacto.streams.PropertyIterator
public final class PropertyIterator
extends Object
implements Iterator<Property>, Iterable<Property>, Spliterator<Property>
Iterates through a PropertyList. This class implements Iterator,
Iterable, and Spliterator. It also provides a Stream interface.
This class is designed to work with OsidStreams to
preserve the exception chain.
OsidStreams.go(() ->
PropertyIterator.stream(propertyList)
.forEach(property -> handle(property)));
-
Nested Class Summary
Nested classes/interfaces inherited from interface Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR> -
Field Summary
Fields inherited from interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintlongvoidforEachRemaining(Consumer<? super Property> action) booleanhasNext()iterator()next()stream()Gets a stream of the elements in this iterator.stream(PropertyList list) Gets a stream over the given list.booleantryAdvance(Consumer<? super Property> action) trySplit()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Spliterator
getComparator, getExactSizeIfKnown, hasCharacteristics
-
Constructor Details
-
PropertyIterator
Creates a newPropertyIterator.- Parameters:
list- the list to iterate
-
-
Method Details
-
hasNext
-
next
-
iterator
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<Property>
-
forEachRemaining
- Specified by:
forEachRemainingin interfaceIterator<Property>- Specified by:
forEachRemainingin interfaceSpliterator<Property>
-
trySplit
- Specified by:
trySplitin interfaceSpliterator<Property>
-
estimateSize
public long estimateSize()- Specified by:
estimateSizein interfaceSpliterator<Property>
-
characteristics
public int characteristics()- Specified by:
characteristicsin interfaceSpliterator<Property>
-
stream
-
stream
Gets a stream over the given list.- Parameters:
list- the list to stream- Returns:
- a stream of the elements
-