commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1586291 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
Date Thu, 10 Apr 2014 13:12:51 GMT
Author: ggregory
Date: Thu Apr 10 13:12:51 2014
New Revision: 1586291

URL: http://svn.apache.org/r1586291
Log:
Statement unnecessarily nested within else clause.

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java?rev=1586291&r1=1586290&r2=1586291&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java
Thu Apr 10 13:12:51 2014
@@ -186,31 +186,30 @@ public class CharSequenceUtils {
             final CharSequence substring, final int start, final int length)    {
         if (cs instanceof String && substring instanceof String) {
             return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring,
start, length);
-        } else {
-            int index1 = thisStart;
-            int index2 = start;
-            int tmpLen = length;
-
-            while (tmpLen-- > 0) {
-                char c1 = cs.charAt(index1++);
-                char c2 = substring.charAt(index2++);
+        }
+        int index1 = thisStart;
+        int index2 = start;
+        int tmpLen = length;
 
-                if (c1 == c2) {
-                    continue;
-                }
+        while (tmpLen-- > 0) {
+            char c1 = cs.charAt(index1++);
+            char c2 = substring.charAt(index2++);
 
-                if (!ignoreCase) {
-                    return false;
-                }
+            if (c1 == c2) {
+                continue;
+            }
 
-                // The same check as in String.regionMatches():
-                if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
-                        && Character.toLowerCase(c1) != Character.toLowerCase(c2))
{
-                    return false;
-                }
+            if (!ignoreCase) {
+                return false;
             }
 
-            return true;
+            // The same check as in String.regionMatches():
+            if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
+                    && Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
+                return false;
+            }
         }
+
+        return true;
     }
 }



Mime
View raw message