Class AbstractCharBidirectionalIterator
- java.lang.Object
-
- org.codelibs.jhighlight.fastutil.chars.AbstractCharIterator
-
- org.codelibs.jhighlight.fastutil.chars.AbstractCharBidirectionalIterator
-
- All Implemented Interfaces:
Iterator<Character>
,BidirectionalIterator<Character>
,CharBidirectionalIterator
,CharIterator
,ObjectBidirectionalIterator<Character>
,ObjectIterator<Character>
- Direct Known Subclasses:
AbstractCharListIterator
,CharIterators.UnmodifiableBidirectionalIterator
public abstract class AbstractCharBidirectionalIterator extends AbstractCharIterator implements CharBidirectionalIterator
An abstract class facilitating the creation of type-specific bidirectional iterators.To create a type-specific bidirectional iterator, besides what is needed for an iterator you need both a method returning the previous element as primitive type and a method returning the previous element as an object. However, if you inherit from this class you need just one (anyone).
This class implements also a trivial version of
back(int)
that uses type-specific methods.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCharBidirectionalIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
back(int n)
This method just iterates the type-specific version ofprevious()
for at mostn
times, stopping ifBidirectionalIterator.hasPrevious()
becomes false.Character
previous()
Delegates to the corresponding type-specific method.char
previousChar()
Delegates to the corresponding generic method.-
Methods inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractCharIterator
next, nextChar, remove, skip
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.BidirectionalIterator
hasPrevious
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.chars.CharIterator
nextChar, skip
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.objects.ObjectIterator
skip
-
-
-
-
Method Detail
-
previousChar
public char previousChar()
Delegates to the corresponding generic method.- Specified by:
previousChar
in interfaceCharBidirectionalIterator
- Returns:
- the previous element in the iteration.
- See Also:
ListIterator.previous()
-
previous
public Character previous()
Delegates to the corresponding type-specific method.- Specified by:
previous
in interfaceBidirectionalIterator<Character>
- Returns:
- the previous element from the collection.
- See Also:
ListIterator.previous()
-
back
public int back(int n)
This method just iterates the type-specific version ofprevious()
for at mostn
times, stopping ifBidirectionalIterator.hasPrevious()
becomes false.- Specified by:
back
in interfaceCharBidirectionalIterator
- Specified by:
back
in interfaceObjectBidirectionalIterator<Character>
- Parameters:
n
- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
Iterator.next()
-
-