Are there interfaces in Java library, which also enumerates some series, but follows slightly another logic than Iterator
and Enumeration
? Namely they should return boolean
on next()
, saying whether next element was reached, and should have getCurrent()
method, which returns current element?
UPDATE
Iterator.next()
is not equivalent of IEnumerator.Current
since former will advance iterator on each call while latter won't.
UPDATE 2
I am designing my own class with my own functionality. My question was in order to find a "competent" analogy. The sample from C#
was just a sample, I am not translating something from C#
to Java
.
This sounds like Guava's PeekingIterator
; you can decorate a plain Iterator
with Iterators.peekingIterator
.