Package nl.vpro.util
Class CountedMaxOffsetIterator<T>
- java.lang.Object
-
- nl.vpro.util.MaxOffsetIterator<T>
-
- nl.vpro.util.CountedMaxOffsetIterator<T>
-
- All Implemented Interfaces:
com.google.common.collect.PeekingIterator<T>
,AutoCloseable
,Iterator<T>
,CloseableIterator<T>
,CloseablePeekingIterator<T>
,CountedIterator<T>
public class CountedMaxOffsetIterator<T> extends MaxOffsetIterator<T> implements CountedIterator<T>
- Since:
- 2.23
- Author:
- Michiel Meeuwissen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CountedMaxOffsetIterator.Builder<T>
-
Nested classes/interfaces inherited from interface nl.vpro.util.CloseableIterator
CloseableIterator.WrappedCloseableIterator<S>, CloseableIterator.WrappedPeekingCloseableIterator<S>
-
-
Field Summary
-
Fields inherited from class nl.vpro.util.MaxOffsetIterator
count, hasNext, next, offsetmax, peekingWrapped, wrapped
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> CountedMaxOffsetIterator.Builder<T>
_countedBuilder()
Long
getCount()
The current position.@NonNull Optional<Long>
getSize()
The size, if known, of the collection this iterator is representing@NonNull Optional<Long>
getTotalSize()
If the iterator is in some way restricted you may also want to report a total size, representing the unrestricted size.-
Methods inherited from class nl.vpro.util.MaxOffsetIterator
autoClose, autoClose, builder, callBack, close, countedBuilder, effectiveCountPredicate, findNext, getOffset, hasNext, next, peek, peekingWrapped, remove, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface nl.vpro.util.CountedIterator
close, peeking, spliterator, stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext
-
-
-
-
Method Detail
-
getSize
public @NonNull Optional<Long> getSize()
Description copied from interface:CountedIterator
The size, if known, of the collection this iterator is representing- Specified by:
getSize
in interfaceCountedIterator<T>
-
getCount
public Long getCount()
Description copied from interface:CountedIterator
The current position. Will return1
after first successfull call toIterator.next()
,2
after the second one, and so on. It will return0
before the first call.- Specified by:
getCount
in interfaceCountedIterator<T>
-
getTotalSize
public @NonNull Optional<Long> getTotalSize()
Description copied from interface:CountedIterator
If the iterator is in some way restricted you may also want to report a total size, representing the unrestricted size.The default implementation is
CountedIterator.getSize()
.- Specified by:
getTotalSize
in interfaceCountedIterator<T>
-
_countedBuilder
public static <T> CountedMaxOffsetIterator.Builder<T> _countedBuilder()
-
-