Module java.base
Package java.lang

Interface CharSequence

All Known Subinterfaces:
Name,Utf8EntryPREVIEW
All Known Implementing Classes:
CharBuffer,Segment,String,StringBuffer,StringBuilder

public interfaceCharSequence
ACharSequence is a readable sequence ofchar values. This interface provides uniform, read-only access to many different kinds ofchar sequences. Achar value represents a character in theBasic Multilingual Plane (BMP) or a surrogate. Refer toUnicode Character Representation for details.

This interface does not refine the general contracts of theequals andhashCode methods. The result of testing two objects that implementCharSequence 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 arbitraryCharSequence instances as elements in a set or as keys in a map.

Since:
1.4