Interface StringReference
- All Superinterfaces:
CharSequence, Comparable<CharSequence>, Reference
- All Known Implementing Classes:
BaseStringReference, BuilderStringReference, DexBackedStringReference, ImmutableStringReference
This class represents a reference to an arbitrary string.
When possible, elsewhere in the interface, a string is represented directly by its value. A StringReference is only
used in those cases where a generic Reference is needed
This type also acts as a CharSequence wrapper around the referenced string value. As per the CharSequence contract,
calling toString() on a StringReference yields the referenced string value. This is the same value returned by
getString().
-
Nested Class Summary
Nested classes/interfaces inherited from interface Reference
Reference.InvalidReferenceException -
Method Summary
Modifier and TypeMethodDescriptionintCompare this StringReference to another StringReference, or more generally to another CharSequence.booleanCompares this StringReference to another CharSequence for equality.Gets the referenced string.inthashCode()Returns a hashcode for this StringReference.Methods inherited from interface CharSequence
charAt, chars, codePoints, getChars, isEmpty, length, subSequence, toStringMethods inherited from interface Reference
validateReference
-
Method Details
-
getString
-
hashCode
-
equals
Compares this StringReference to another CharSequence for equality. String StringReference is equal to a CharSequence iff this.getString().equals(other.toString()). Equivalently, This StringReference is equal to another StringReference iff this.getString().equals(other.getString()). -
compareTo
Compare this StringReference to another StringReference, or more generally to another CharSequence. The comparison is defined to be this.getString().compareTo(other.toString()).- Specified by:
compareToin interfaceComparable<CharSequence>- Parameters:
o- The CharSequence to compare with this StringReference- Returns:
- An integer representing the result of the comparison
-