Replace occurrences of Wrapped.valueOf(...) with Wrapped.parseWrapped(...)

where the value will be immediately unboxed anyway.

The change removes small-but-pervasive inefficiencies from creating and
immediately discarding instances of the wrapped value, as well as removing
unnecessary syntax.

More information: []

Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189704431
This commit is contained in:
jianglai 2018-03-20 01:11:32 -07:00
parent 70e9df7435
commit d54d546ea3
3 changed files with 3 additions and 3 deletions

View file

@ -501,7 +501,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
checkNotNull( checkNotNull(
params.get(PARAM_SERVER_TRANSACTION_ID), "Server transaction id not specified")) params.get(PARAM_SERVER_TRANSACTION_ID), "Server transaction id not specified"))
.setIsSuperuser( .setIsSuperuser(
Boolean.valueOf( Boolean.parseBoolean(
checkNotNull(params.get(PARAM_IS_SUPERUSER), "Is superuser not specified"))) checkNotNull(params.get(PARAM_IS_SUPERUSER), "Is superuser not specified")))
.setRequestedTime( .setRequestedTime(
DateTime.parse( DateTime.parse(

View file

@ -84,7 +84,7 @@ public final class RequestParameters {
*/ */
public static int extractIntParameter(HttpServletRequest req, String name) { public static int extractIntParameter(HttpServletRequest req, String name) {
try { try {
return Integer.valueOf(nullToEmpty(req.getParameter(name))); return Integer.parseInt(nullToEmpty(req.getParameter(name)));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new BadRequestException("Expected integer: " + name); throw new BadRequestException("Expected integer: " + name);
} }

View file

@ -137,6 +137,6 @@ public final class IdnTable {
checkArgument(matcher.lookingAt(), "Can't parse line: %s", line); checkArgument(matcher.lookingAt(), "Can't parse line: %s", line);
String hexString = matcher.group(1); String hexString = matcher.group(1);
return Integer.valueOf(hexString, 16); return Integer.parseInt(hexString, 16);
} }
} }