- All Superinterfaces:
- CharSequence
public interface Name extends 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 Names 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:
- Elements.getName(java.lang.CharSequence)
- 
Method SummaryModifier and Type Method Description booleancontentEquals(CharSequence cs)Compares this name to the specifiedCharSequence.booleanequals(Object obj)Returnstrueif the argument represents the same name asthis, andfalseotherwise.inthashCode()Obeys the general contract ofObject.hashCode.Methods declared in interface java.lang.CharSequencecharAt, chars, codePoints, length, subSequence, toString
- 
Method Details- 
equalsReturnstrueif the argument represents the same name asthis, andfalseotherwise.Note that the identity of a Nameis a function both of its content in terms of a sequence of characters as well as the implementation which created it.- Overrides:
- equalsin class- Object
- Parameters:
- obj- the object to be compared with this element
- Returns:
- trueif the specified object represents the same name as this
- See Also:
- Element.equals(java.lang.Object)
 
- 
hashCodeint hashCode()Obeys the general contract ofObject.hashCode.- Overrides:
- hashCodein class- Object
- Returns:
- a hash code value for this object.
- See Also:
- equals(java.lang.Object)
 
- 
contentEqualsCompares this name to the specifiedCharSequence. The result istrueif and only if this name represents the same sequence ofcharvalues as the specified sequence.- Parameters:
- cs- The sequence to compare this name against
- Returns:
- trueif this name represents the same sequence of- charvalues as the specified sequence,- falseotherwise
- See Also:
- String.contentEquals(CharSequence)
 
 
-