- All Superinterfaces:
CharSequence
An immutable sequence of characters. When created by the same
implementation, objects implementing this interface must obey the
general equals contract when compared
with each other. Therefore,
Name
objects from the same
implementation are usable in collections while Name
s from
different implementations may not work properly in collections.
An empty
Name
has a length of
zero.
In the context of annotation processing, the guarantees for "the same" implementation must include contexts where the API mediated side effects of processors could be visible to each other, including successive annotation processing rounds.
- Since:
- 1.6
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this name to the specifiedCharSequence
.boolean
Returnstrue
if the argument represents the same name asthis
, andfalse
otherwise.int
hashCode()
Obeys the general contract ofObject.hashCode
.Methods declared in interface java.lang.CharSequence
charAt, chars, codePoints, isEmpty, length, subSequence, toString
-
Method Details
-
equals
Returnstrue
if the argument represents the same name asthis
, andfalse
otherwise.Note that the identity of a
Name
is a function both of its content in terms of a sequence of characters as well as the implementation which created it. -
hashCode
int hashCode()Obeys the general contract ofObject.hashCode
. -
contentEquals
Compares this name to the specifiedCharSequence
. The result istrue
if and only if this name represents the same sequence ofchar
values as the specified sequence.- Parameters:
cs
- The sequence to compare this name against- Returns:
true
if this name represents the same sequence ofchar
values as the specified sequence,false
otherwise- See Also:
-