[
https://issues.apache.org/jira/browse/LANG-1436?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary Gregory resolved LANG-1436.
--------------------------------
Resolution: Fixed
Fix Version/s: 3.9
Please verify and close.
> Consolidate StringUtils equals and equalsIgnoreCase method
> ----------------------------------------------------------
>
> Key: LANG-1436
> URL: https://issues.apache.org/jira/browse/LANG-1436
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.*
> Affects Versions: 3.8.1
> Reporter: Alex D Herbert
> Priority: Trivial
> Fix For: 3.9
>
>
> The methods {{equals}} and {{equalsIgnoreCase}} in {{StringUtils}} are
> essentially the same method but one is case insensitive. However the method
> arguments have different names, the edge case check logic is different (with
> the same effect) and the javadocs are slightly different.
> The {{equals}} method also calls a {{CharSequenceUtils}} helper method which
> is unnecessary as that contains functionality that is not used, i.e. the case
> insensitivity. This can be updated to just do a simple step-wise charAt
> comparison through the entire {{CharSequence}}:
> {code:java}
> final int length = cs1.length();
> for (int i = 0; i < length; i++) {
> if (cs1.charAt(i) != cs2.charAt(i)) {
> return false;
> }
> }
> {code}
> The result is code that does the same as before but is cleaner to understand.
> This change will consolidate the two methods to improve the similarity in
> both the documentation and the implementation:
> * Update the parameter names to match
> * Update the Javadoc to match with the exception of case sensitivity
> * Update the edge case logic to match in the implementation
> * Update to use a step-wise {{charAt}} comparison
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)