You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Loic Guibert <lg...@apache.org> on 2015/11/05 11:55:42 UTC

[LANG] Add StringUtils methods to compare a string to multiple strings

Hello,
there are 2 tickets on JIRA on this same new feature:
Add StringUtils methods to compare a string to multiple strings
(equalsAny, equalsAnyIgnoreCase)

  https://issues.apache.org/jira/browse/LANG-704
  https://issues.apache.org/jira/browse/LANG-1169

I review the 2 proposed implementation and I think we should keep
the last one (LANG-1169 / GitHub PR #109).

In the patch submitted for LANG-704, I disagree with these results,
it sounds illogical for me :
  StringUtils.equalsAnyOf(null, null, null) = false
  StringUtils.equalsAnyOf(null, (CharSequence[]) null) = true

For the LANG-1169 / GitHub PR #109, all seems good for me
I would just add some tests (I tested them, they are OK) :
  assertFalse(StringUtils.equalsAny(null, (CharSequence[]) null));
  assertTrue(StringUtils.equalsAny(FOO, new CustomCharSequence("foo")));
  assertTrue(StringUtils.equalsAny(FOO, new StringBuilder("foo")));
  assertFalse(StringUtils.equalsAny(FOO, new CustomCharSequence("fOo")));
  assertFalse(StringUtils.equalsAny(FOO, new StringBuilder("fOo")));

  assertFalse(StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null));
  assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new
CustomCharSequence("fOo")));
  assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new
StringBuilder("fOo")));


If nobody objects or disagree with it, I'll :
  - close LANG-704 (duplicate LANG-1169)
  - merge PR #109
  - add the supplementary tests
  - mark LANG-1169 resolved


Regards,

-- 
Loic Guibert
PGP : 0x65EB4F33


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [LANG] Add StringUtils methods to compare a string to multiple strings

Posted by Benedikt Ritter <br...@apache.org>.
Hello Loic,

2015-11-05 11:55 GMT+01:00 Loic Guibert <lg...@apache.org>:

> Hello,
> there are 2 tickets on JIRA on this same new feature:
> Add StringUtils methods to compare a string to multiple strings
> (equalsAny, equalsAnyIgnoreCase)
>
>   https://issues.apache.org/jira/browse/LANG-704
>   https://issues.apache.org/jira/browse/LANG-1169
>
> I review the 2 proposed implementation and I think we should keep
> the last one (LANG-1169 / GitHub PR #109).
>
> In the patch submitted for LANG-704, I disagree with these results,
> it sounds illogical for me :
>   StringUtils.equalsAnyOf(null, null, null) = false
>   StringUtils.equalsAnyOf(null, (CharSequence[]) null) = true
>
> For the LANG-1169 / GitHub PR #109, all seems good for me
> I would just add some tests (I tested them, they are OK) :
>   assertFalse(StringUtils.equalsAny(null, (CharSequence[]) null));
>   assertTrue(StringUtils.equalsAny(FOO, new CustomCharSequence("foo")));
>   assertTrue(StringUtils.equalsAny(FOO, new StringBuilder("foo")));
>   assertFalse(StringUtils.equalsAny(FOO, new CustomCharSequence("fOo")));
>   assertFalse(StringUtils.equalsAny(FOO, new StringBuilder("fOo")));
>
>   assertFalse(StringUtils.equalsAnyIgnoreCase(null, (CharSequence[])
> null));
>   assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new
> CustomCharSequence("fOo")));
>   assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new
> StringBuilder("fOo")));
>
>
> If nobody objects or disagree with it, I'll :
>   - close LANG-704 (duplicate LANG-1169)
>   - merge PR #109
>   - add the supplementary tests
>   - mark LANG-1169 resolved
>

This sounds reasonable to me.

Even if we don't use the proposal from LANG-704, we should give the author
credit for his contribution. For example the commit log could contain
something like

"Thanks to Author1 for providing a patch. Thanks to Author2 for providing
an alternative implementaion, see LANG-704."

Regards,
Benedikt


>
>
> Regards,
>
> --
> Loic Guibert
> PGP : 0x65EB4F33
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter