Package nl.vpro.util
Class BasicWrappedIterator<T>
java.lang.Object
nl.vpro.util.WrappedIterator<T,T>
nl.vpro.util.BasicWrappedIterator<T>
- All Implemented Interfaces:
AutoCloseable
,Iterator<T>
,CloseableIterator<T>
,Counted
,CountedIterator<T>
- Direct Known Subclasses:
MergedSortedIterator
- Since:
- 0.31
- Author:
- Michiel Meeuwissen
-
Nested Class Summary
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.WrappedIterator
wrapped
-
Constructor Summary
ModifierConstructorDescriptionBasicWrappedIterator
(Long size, Long totalSize, Iterator<T> wrapped) BasicWrappedIterator
(Long totalSize, Iterator<T> wrapped) BasicWrappedIterator
(Collection<T> wrapped) BasicWrappedIterator
(AtomicLong size, AtomicLong totalSize, Iterator<T> wrapped) BasicWrappedIterator
(AtomicLong totalSize, Iterator<T> wrapped) protected
BasicWrappedIterator
(Supplier<Long> sizeSupplier, Supplier<Long> totalSizeSupplier, Long size, Long totalSize, Iterator<T> wrapped) BasicWrappedIterator
(Iterator<T> wrapped) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> BasicWrappedIterator.Builder<T>
builder()
getCount()
The current position.getSize()
The size, if known, of the collection this iterator is representingIf the iterator is in some way restricted you may also want to report a total size, representing the unrestricted size.next()
Methods inherited from class nl.vpro.util.WrappedIterator
close, hasNext, iterator, 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
peeking, spliterator, stream
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
BasicWrappedIterator
-
BasicWrappedIterator
-
BasicWrappedIterator
-
BasicWrappedIterator
-
BasicWrappedIterator
-
BasicWrappedIterator
-
BasicWrappedIterator
-
-
Method Details
-
getSize
Description copied from interface:CountedIterator
The size, if known, of the collection this iterator is representing- Specified by:
getSize
in interfaceCountedIterator<T>
- Overrides:
getSize
in classWrappedIterator<T,
T>
-
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>
- Overrides:
getTotalSize
in classWrappedIterator<T,
T>
-
next
-
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 interfaceCounted
- Specified by:
getCount
in interfaceCountedIterator<T>
- Overrides:
getCount
in classWrappedIterator<T,
T>
-
builder
-