Cloneable, CharacterIteratorpublic final class StringCharacterIterator extends Object implements CharacterIterator
StringCharacterIterator implements the
CharacterIterator protocol for a String.
The StringCharacterIterator class iterates over the
entire String.CharacterIteratorDONE| 构造器 | 说明 |
|---|---|
StringCharacterIterator(String text) |
Constructs an iterator with an initial index of 0.
|
StringCharacterIterator(String text,
int pos) |
Constructs an iterator with the specified initial index.
|
StringCharacterIterator(String text,
int begin,
int end,
int pos) |
Constructs an iterator over the given range of the given string, with the
index set at the specified position.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
Object |
clone() |
Creates a copy of this iterator.
|
char |
current() |
Implements CharacterIterator.current() for String.
|
boolean |
equals(Object obj) |
Compares the equality of two StringCharacterIterator objects.
|
char |
first() |
Implements CharacterIterator.first() for String.
|
int |
getBeginIndex() |
Implements CharacterIterator.getBeginIndex() for String.
|
int |
getEndIndex() |
Implements CharacterIterator.getEndIndex() for String.
|
int |
getIndex() |
Implements CharacterIterator.getIndex() for String.
|
int |
hashCode() |
Computes a hashcode for this iterator.
|
char |
last() |
Implements CharacterIterator.last() for String.
|
char |
next() |
Implements CharacterIterator.next() for String.
|
char |
previous() |
Implements CharacterIterator.previous() for String.
|
char |
setIndex(int p) |
Implements CharacterIterator.setIndex() for String.
|
void |
setText(String text) |
Reset this iterator to point to a new string.
|
public StringCharacterIterator(String text)
text - the String to be iterated overpublic StringCharacterIterator(String text, int pos)
text - The String to be iterated overpos - Initial iterator positionpublic StringCharacterIterator(String text, int begin, int end, int pos)
text - The String to be iterated overbegin - Index of the first characterend - Index of the character following the last characterpos - Initial iterator positionpublic void setText(String text)
text - The String to be iterated overpublic char first()
first 在接口中 CharacterIteratorCharacterIterator.first()public char last()
last 在接口中 CharacterIteratorCharacterIterator.last()public char setIndex(int p)
setIndex 在接口中 CharacterIteratorp - the position within the text. Valid values range from
getBeginIndex() to getEndIndex(). An IllegalArgumentException is thrown
if an invalid value is supplied.CharacterIterator.setIndex(int)public char current()
current 在接口中 CharacterIteratorCharacterIterator.current()public char next()
next 在接口中 CharacterIteratorCharacterIterator.next()public char previous()
previous 在接口中 CharacterIteratorCharacterIterator.previous()public int getBeginIndex()
getBeginIndex 在接口中 CharacterIteratorCharacterIterator.getBeginIndex()public int getEndIndex()
getEndIndex 在接口中 CharacterIteratorCharacterIterator.getEndIndex()public int getIndex()
getIndex 在接口中 CharacterIteratorCharacterIterator.getIndex()public boolean equals(Object obj)
equals 在类中 Objectobj - the StringCharacterIterator object to be compared with.Object.hashCode(),
HashMappublic int hashCode()
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)