OSDN Git Service

Avoid redundant Long allocation before unboxing
authorTobias Thierer <tobiast@google.com>
Thu, 21 Apr 2016 13:45:43 +0000 (14:45 +0100)
committerTobias Thierer <tobiast@google.com>
Thu, 21 Apr 2016 13:45:59 +0000 (14:45 +0100)
long x = Long.valueOf(s) --> Long.parseLong()

Bug: 28289401
Change-Id: I0a6766d44a522b6dd5c7afc5e81ebe135103315e

test/099-vmdebug/src/Main.java

index 1be5765..8068721 100644 (file)
@@ -133,7 +133,7 @@ public class Main {
             System.out.println("Got null string");
             return;
         }
-        long n = Long.valueOf(s);
+        long n = Long.parseLong(s);
         if (n < 0) {
             System.out.println("Got negative number " + n);
         }
@@ -157,8 +157,8 @@ public class Main {
                 System.out.println("Got bad bucket " + bucket);
                 continue;
             }
-            long key = Long.valueOf(kv[0]);
-            long value = Long.valueOf(kv[1]);
+            long key = Long.parseLong(kv[0]);
+            long value = Long.parseLong(kv[1]);
             if (key < 0 || value < 0) {
                 System.out.println("Got negative key or value " + bucket);
                 continue;