]> granicus.if.org Git - icu/commitdiff
ICU-8854 Inefficient use of number constructors. Use valueOf instead.
authorAbhinav Gupta <mail@abhinavg.net>
Mon, 17 Oct 2011 20:23:48 +0000 (20:23 +0000)
committerAbhinav Gupta <mail@abhinavg.net>
Mon, 17 Oct 2011 20:23:48 +0000 (20:23 +0000)
X-SVN-Rev: 30836

icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java
icu4j/main/classes/core/src/com/ibm/icu/text/NFRule.java
icu4j/main/classes/core/src/com/ibm/icu/text/RuleBasedNumberFormat.java
icu4j/main/classes/core/src/com/ibm/icu/text/TimeUnitFormat.java

index 3dbe12aa14da177c764e1a2691692ae20f752252..b6c25c3eac91586ecd3a27e4edd2472a0685380b 100644 (file)
@@ -1756,7 +1756,7 @@ public class DecimalFormat extends NumberFormat {
                             l = -l;
                         }
                     }
-                    n = new Long(l);
+                    n = Long.valueOf(l);
                 } else {
                     BigInteger big = digitList.getBigInteger(status[STATUS_POSITIVE]);
                     n = (big.bitLength() < 64) ? (Number) Long.valueOf(big.longValue()) : (Number) big;
index ba910e2227ebf13deb1e064676fb46e4bb353f09..027db7920afa718516d031ae01fbdfc0bd0f157a 100644 (file)
@@ -748,7 +748,7 @@ final class NFRule {
         if (pp.getIndex() == 0 && sub1.getPos() != 0) {
             // commented out because ParsePosition doesn't have error index in 1.1.x
             //                parsePosition.setErrorIndex(pp.getErrorIndex());
-            return new Long(0);
+            return Long.valueOf(0);
         }
 
         // this is the fun part.  The basic guts of the rule-matching
@@ -993,7 +993,7 @@ final class NFRule {
             // if we make it here, this was an unsuccessful match, and we
             // leave pp unchanged and return 0
             pp.setIndex(0);
-            return new Long(0);
+            return Long.valueOf(0);
 
             // if "delimiter" is empty, or consists only of ignorable characters
             // (i.e., is semantically empty), thwe we obviously can't search
index c5ce33886bcc8ea804cac1e33f718a6fa9ba4673..2eed61c930515ee74302d8d36ca166bd5aa913f7 100644 (file)
@@ -1183,7 +1183,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
         //TODO: We need a real fix.  See #6895 / #6896
         if (noParse) {
             // skip parsing
-            return new Long(0);
+            return Long.valueOf(0);
         }
 
         // parsePosition tells us where to start parsing.  We copy the
index 7ea43a60b9941286d0acd6419d51f762cfb06ef3..2e6f06138cf04b1a2204c22ee546ef8a293aea80 100644 (file)
@@ -290,11 +290,11 @@ public class TimeUnitFormat extends MeasureFormat {
         if (resultNumber == null && longestParseDistance != 0) {
             // set the number using plurrual count
             if ( countOfLongestMatch.equals("zero") ) {
-                resultNumber = new Integer(0);
+                resultNumber = Integer.valueOf(0);
             } else if ( countOfLongestMatch.equals("one") ) {
-                resultNumber = new Integer(1);
+                resultNumber = Integer.valueOf(1);
             } else if ( countOfLongestMatch.equals("two") ) {
-                resultNumber = new Integer(2);
+                resultNumber = Integer.valueOf(2);
             } else {
                 // should not happen.
                 // TODO: how to handle?