Package nl.vpro.util
Class WrappedIterator<T,S>
java.lang.Object
nl.vpro.util.WrappedIterator<T,S>
- All Implemented Interfaces:
AutoCloseable
,Iterator<S>
,CloseableIterator<S>
,Counted
,CountedIterator<S>
- Direct Known Subclasses:
BasicWrappedIterator
- Since:
- 1.3
- Author:
- Michiel Meeuwissen
-
Nested Class Summary
Nested classes/interfaces inherited from interface nl.vpro.util.CloseableIterator
CloseableIterator.WrappedCloseableIterator<S>, CloseableIterator.WrappedPeekingCloseableIterator<S>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.boolean
hasNext()
iterator()
abstract S
next()
void
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
-
Field Details
-
wrapped
-
-
Constructor Details
-
WrappedIterator
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
iterator
-
getSize
Description copied from interface:CountedIterator
The size, if known, of the collection this iterator is representing- Specified by:
getSize
in interfaceCountedIterator<T>
-
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>
-
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>
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCountedIterator<T>
- Throws:
Exception
-
toString
-