Bug 1413620 - Prefer Integer.valueOf over new Integer. r=nalexander,nechen
authorAndrew Gaul <andrew@gaul.org>
Wed, 01 Nov 2017 10:40:27 -0700
changeset 392070 255f29fb55cebf239ad14360b368b48b5cfc81c4
parent 392069 c995692a3c92e3fc2e31849c25eb8da49afa1326
child 392071 536b33289c5c37e6d43ee12fb4783549dfa5bce9
push id97391
push usernbeleuzu@mozilla.com
push dateWed, 15 Nov 2017 23:49:34 +0000
treeherdermozilla-inbound@255f29fb55ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, nechen
bugs1413620
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1413620 - Prefer Integer.valueOf over new Integer. r=nalexander,nechen The former uses the Integer object cache to avoid allocations.
mobile/android/base/java/org/mozilla/gecko/db/LocalURLMetadata.java
--- a/mobile/android/base/java/org/mozilla/gecko/db/LocalURLMetadata.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/LocalURLMetadata.java
@@ -77,17 +77,17 @@ public class LocalURLMetadata implements
             if (obj.has("touchIconList") &&
                     (icons = obj.getJSONObject("touchIconList")).length() > 0) {
                 int preferredSize = GeckoAppShell.getPreferredIconSize();
 
                 Iterator<String> keys = icons.keys();
 
                 ArrayList<Integer> sizes = new ArrayList<Integer>(icons.length());
                 while (keys.hasNext()) {
-                    sizes.add(new Integer(keys.next()));
+                    sizes.add(Integer.valueOf(keys.next()));
                 }
 
                 final int bestSize = LoadFaviconResult.selectBestSizeFromList(sizes, preferredSize);
                 final String iconURL = icons.getString(Integer.toString(bestSize));
 
                 data.put(URLImageDataTable.TOUCH_ICON_COLUMN, iconURL);
             }
         } catch (JSONException e) {