Name
CharSequence
Synopsis
This
interface defines a simple API for read-only access to sequences of
characters. In the core platform it is implemented by the
String, StringBuffer and
java.nio.CharBuffer classes. charAt(
)
returns the character at a specified position in the sequence.
length( )
returns the number of characters in the sequence.
subSequence( )
returns a CharSequence that consists of the
characters starting at, and including, the specified
start index, and continuing up to, but not
including the specified end index.
Finally, toString( )
returns a String version of the sequence.
Note that CharSequence implementations do not
typically have interoperable equals( ) or
hashCode( ) methods, and it is not usually
possible to compare two CharSequence objects or
use multiple sequences in a set or hashtable unless they are
instances of the same implementing class.
public interface CharSequence { // Public Instance Methods char charAt(int index); int length( ); CharSequence subSequence(int start, int end); String toString( ); }
Implementations
String, StringBuffer,
StringBuilder,
java.nio.CharBuffer
Passed To
Too many methods to list.
Returned By
String.subSequence( ),
StringBuffer.subSequence( ),
java.nio.CharBuffer.subSequence( )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access