Is your proposed method a stepwise charAt comparison across both, assuming non-null and equal length? Doesn't seem like a bad idea, though I'm curious whether there's a use-case where toString() on both and comparing isn't more expedient.
On Sat, Mar 2, 2019 at 11:53 AM Alex Herbert <alex.d.herb...@gmail.com> wrote: > I am helping with the PR for TEXT-126 to add to the similarity package. > > Part of the new algorithm requires identifying if two CharSequences are > identical. Is there a utility in Text to do something like this: > > public static boolean CharSequenceUtils.equals(CharSequence, CharSequence); > > I cannot find one with a quick regex search of the library. I am not > familiar with Lang either but this is a dependency so a method from there > could be used. > > The current PR is using left.equals(right) on the input CharSequence to > compare to one to another which is wrong if the two input CharSequences do > not support matching, e.g. if the input was a String and StringBuilder then > String.equals(StringBuilder) would not match, even if the characters were > the same. > > Regards, > > Alex > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > >