commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1606075 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java
Date Fri, 27 Jun 2014 12:55:51 GMT
Author: ggregory
Date: Fri Jun 27 12:55:51 2014
New Revision: 1606075

URL: http://svn.apache.org/r1606075
Log:
Simplify using ternary expressions.

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

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java?rev=1606075&r1=1606074&r2=1606075&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Conversion.java Fri Jun
27 12:55:51 2014
@@ -324,49 +324,25 @@ public class Conversion {
         if (src.length > srcPos + 3 && src[srcPos + 3]) {
             if (src.length > srcPos + 2 && src[srcPos + 2]) {
                 if (src.length > srcPos + 1 && src[srcPos + 1]) {
-                    if (src[srcPos]) {
-                        return 'f';
-                    }
-                    return 'e';
+                    return src[srcPos] ? 'f' : 'e';
                 }
-                if (src[srcPos]) {
-                    return 'd';
-                }
-                return 'c';
+                return src[srcPos] ? 'd' : 'c';
             }
             if (src.length > srcPos + 1 && src[srcPos + 1]) {
-                if (src[srcPos]) {
-                    return 'b';
-                }
-                return 'a';
-            }
-            if (src[srcPos]) {
-                return '9';
+                return src[srcPos] ? 'b' : 'a';
             }
-            return '8';
+            return src[srcPos] ? '9' : '8';
         }
         if (src.length > srcPos + 2 && src[srcPos + 2]) {
             if (src.length > srcPos + 1 && src[srcPos + 1]) {
-                if (src[srcPos]) {
-                    return '7';
-                }
-                return '6';
-            }
-            if (src[srcPos]) {
-                return '5';
+                return src[srcPos] ? '7' : '6';
             }
-            return '4';
+            return src[srcPos] ? '5' : '4';
         }
         if (src.length > srcPos + 1 && src[srcPos + 1]) {
-            if (src[srcPos]) {
-                return '3';
-            }
-            return '2';
-        }
-        if (src[srcPos]) {
-            return '1';
+            return src[srcPos] ? '3' : '2';
         }
-        return '0';
+        return src[srcPos] ? '1' : '0';
     }
 
     /**



Mime
View raw message