final class CharacterIterator extends Object
| Constructor and Description |
|---|
CharacterIterator(String s)
Creates a new iterator initialized with the given input string.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) char |
current()
Returns character at the current position.
|
(package private) String |
getInput()
Returns the input String on which this
CharacterIterator iterator operates. |
(package private) boolean |
hasNext()
Determines whether there is next character in the iteration chain.
|
(package private) char |
next()
Returns next character in the iteration chain and increase the current position.
|
(package private) char |
peek()
Returns the next character without increasing the position.
|
(package private) int |
pos()
Returns the current internal position of the iterator.
|
(package private) void |
setPosition(int newPosition)
Changes the current position to the position.
|
private int pos
private String s
CharacterIterator(String s)
s - String trough which the iterator iterates.boolean hasNext()
#next(), false otherwise.char next()
RuntimeException - The method might throw exception when there is no more character to be retrieved.char peek()
#next() but the
position is not changed by calling this method.int pos()
String getInput()
CharacterIterator iterator operates.void setPosition(int newPosition)
newPosition - New position for the iterator.char current()
Copyright © 2014 Sven Strittmatter. All Rights Reserved.