Tidy up uses of Integer.valueOf.

Use parseInt when the result is assigned to an int. Allocates fewer
objects.

bug: 28078871
Change-Id: Icbb0507949b71bc0a729f2e65309dab939b3d853
This commit is contained in:
Narayan Kamath
2016-04-19 11:48:33 +01:00
parent 6a65b38d23
commit d6ea1e86f2
3 changed files with 5 additions and 5 deletions

View File

@@ -138,8 +138,8 @@ public class CubeWallpaper2 extends WallpaperService {
for (int i = 0; i < numlines; i++) { for (int i = 0; i < numlines; i++) {
mLines[i] = new ThreeDLine(); mLines[i] = new ThreeDLine();
String [] idx = l[i].split(" "); String [] idx = l[i].split(" ");
mLines[i].startPoint = Integer.valueOf(idx[0]); mLines[i].startPoint = Integer.parseInt(idx[0]);
mLines[i].endPoint = Integer.valueOf(idx[1]); mLines[i].endPoint = Integer.parseInt(idx[1]);
} }
} }

View File

@@ -161,7 +161,7 @@ public class AddFileActivity extends Activity {
return; return;
} }
long fileSize = Integer.valueOf(fileSizeEditTextValue) * mSizeMultiplier; long fileSize = Long.parseLong(fileSizeEditTextValue) * mSizeMultiplier;
if (mFileStorage == FileStorage.EXTERNAL && !Utils.isExternalStorageAvailable()) { if (mFileStorage == FileStorage.EXTERNAL && !Utils.isExternalStorageAvailable()) {
Toast toast = Toast.makeText(this, Toast toast = Toast.makeText(this,

View File

@@ -260,13 +260,13 @@ public class PolicySetupActivity extends Activity {
int passwordLength = 0; int passwordLength = 0;
try { try {
passwordLength = Integer.valueOf(mPasswordLengthInputField.getText().toString()); passwordLength = Integer.parseInt(mPasswordLengthInputField.getText().toString());
} catch (NumberFormatException nfe) {} // Defaults to 0. } catch (NumberFormatException nfe) {} // Defaults to 0.
int passwordMinUppercase = 0; int passwordMinUppercase = 0;
try { try {
passwordMinUppercase = passwordMinUppercase =
Integer.valueOf(mPasswordMinUppercaseInputField.getText().toString()); Integer.parseInt(mPasswordMinUppercaseInputField.getText().toString());
} catch (NumberFormatException nfe) {} // Defaults to 0. } catch (NumberFormatException nfe) {} // Defaults to 0.
mPolicy.saveToLocal(passwordQuality, passwordLength, passwordMinUppercase); mPolicy.saveToLocal(passwordQuality, passwordLength, passwordMinUppercase);