StringCharacterIterator

public final class StringCharacterIterator extends Object
implements CharacterIterator

An implementation of CharacterIterator for strings.

Inherited Constant Summary

Public Constructor Summary

StringCharacterIterator(String value)
Constructs a new StringCharacterIterator on the specified string.
StringCharacterIterator(String value, int location)
Constructs a new StringCharacterIterator on the specified string with the current index set to the specified value.
StringCharacterIterator(String value, int start, int end, int location)
Constructs a new StringCharacterIterator on the specified string with the begin, end and current index set to the specified values.

Public Method Summary

Object
clone()
Returns a new StringCharacterIterator with the same source string, begin, end, and current index as this iterator.
char
current()
Returns the character at the current index in the source string.
boolean
equals(Object object)
Compares the specified object with this StringCharacterIterator and indicates if they are equal.
char
first()
Sets the current position to the begin index and returns the character at the new position in the source string.
int
getBeginIndex()
Returns the begin index in the source string.
int
getEndIndex()
Returns the end index in the source string.
int
getIndex()
Returns the current index in the source string.
int
hashCode()
Returns an integer hash code for this object.
char
last()
Sets the current position to the end index - 1 and returns the character at the new position.
char
next()
Increments the current index and returns the character at the new index.
char
previous()
Decrements the current index and returns the character at the new index.
char
setIndex(int location)
Sets the current index in the source string.
void
setText(String value)
Sets the source string to iterate over.

Inherited Method Summary

Public Constructors

public StringCharacterIterator (String value)

Constructs a new StringCharacterIterator on the specified string. The begin and current indices are set to the beginning of the string, the end index is set to the length of the string.

Parameters