CharSequence
is a readable sequence of char
values. This
interface provides uniform, read-only access to many different kinds of
char
sequences.
A char
value represents a character in the Basic
Multilingual Plane (BMP) or a surrogate. Refer to Unicode Character Representation for details.
This interface does not refine the general contracts of the equals
and hashCode
methods. The result of testing two objects
that implement CharSequence
for equality is therefore, in general, undefined.
Each object may be implemented by a different class, and there
is no guarantee that each class will be capable of testing its instances
for equality with those of the other. It is therefore inappropriate to use
arbitrary CharSequence
instances as elements in a set or as keys in
a map.
Modifier and Type | Method and Description |
---|---|
public char | Returns: the specifiedchar valuethe index of the index)char value to be returnedReturns the |
public default IntStream | Returns: an IntStream of char values from this sequenceReturns a stream of |
public default IntStream | Returns: an IntStream of Unicode code points from this sequenceReturns a stream of code point values from this sequence. |
public static int | Returns: the value0 if the two CharSequence are equal;
a negative integer if the first CharSequence
is lexicographically less than the second; or a
positive integer if the first CharSequence is
lexicographically greater than the second.the first cs1, CharSequence CharSequence the second cs2)CharSequence Compares two |
public default boolean | |
public int | |
public CharSequence | Returns: the specified subsequencethe start index, inclusive start, int the end index, exclusive end)Returns a |
public String | Returns: a string consisting of exactly this sequence of charactersReturns a string containing the characters in this sequence in the same order as this sequence. |
charAt | back to summary |
---|---|
public char charAt(int index) Returns the If the
|
chars | back to summary |
---|---|
public default IntStream chars() Returns a stream of The stream binds to this sequence when the terminal stream operation commences (specifically, for mutable sequences the spliterator for the stream is late-binding). If the sequence is modified during that operation then the result is undefined.
|
codePoints | back to summary |
---|---|
public default IntStream codePoints() Returns a stream of code point values from this sequence. Any surrogate
pairs encountered in the sequence are combined as if by Character.toCodePoint and the result is passed
to the stream. Any other code units, including ordinary BMP characters,
unpaired surrogates, and undefined code units, are zero-extended to
The stream binds to this sequence when the terminal stream operation commences (specifically, for mutable sequences the spliterator for the stream is late-binding). If the sequence is modified during that operation then the result is undefined.
|
compare | back to summary |
---|---|
public static int compare(CharSequence cs1, CharSequence cs2) Compares two
The lexicographical ordering of
|
isEmpty | back to summary |
---|---|
public default boolean isEmpty() Returns Implementation Specification The default implementation returns the result of calling
|
length | back to summary |
---|---|
public int length() Returns the length of this character sequence. The length is the number
of 16-bit
|
subSequence | back to summary |
---|---|
public CharSequence subSequence(int start, int end) Returns a
|
toString | back to summary |
---|---|
public String toString() Returns a string containing the characters in this sequence in the same order as this sequence. The length of the string will be the length of this sequence.
|