In Android, You sometimes get CharSequence as a parameter of a callback.
It might be tempting to check for equality using “equals” method of a String.
But this would be a bug:
because equals requires the other object to be an instance of String as well, as explained in JavaDoc of String.equals :
public boolean equals(Object anObject) Compares this string to the specified object. The result is
trueif and only if the argument is not
nulland is a
Stringobject that represents the same sequence of characters as this object.
The correct way would be to use contentEquals: