Always use the constructor to make Immutable Collection Builders

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135359669
This commit is contained in:
mcilwain 2016-10-06 08:09:47 -07:00 committed by Ben McIlwain
parent 79387f5d1e
commit b65b855067
16 changed files with 29 additions and 32 deletions

View file

@ -81,7 +81,7 @@ abstract class EppToolCommand extends ConfirmingCommand implements ServerSideCom
* EPP calls when invoking commands (i.e. domain check) with sets of domains across multiple TLDs.
*/
protected static Multimap<String, String> validateAndGroupDomainNamesByTld(List<String> names) {
ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder();
ImmutableMultimap.Builder<String, String> builder = new ImmutableMultimap.Builder<>();
for (String name : names) {
InternetDomainName tld = findTldForNameOrThrow(InternetDomainName.from(name));
builder.put(tld.toString(), name);

View file

@ -45,13 +45,13 @@ public final class GetLrpTokenCommand implements RemoteApiCommand {
names = {"-h", "--history"},
description = "Return expanded history entry (including domain application)")
private boolean includeHistory = false;
@Override
public void run() throws Exception {
checkArgument(
(tokenString == null) == (assignee != null),
"Exactly one of either token or assignee must be specified.");
ImmutableSet.Builder<LrpToken> tokensBuilder = ImmutableSet.builder();
ImmutableSet.Builder<LrpToken> tokensBuilder = new ImmutableSet.Builder<>();
if (tokenString != null) {
LrpToken token = ofy().load().key(Key.create(LrpToken.class, tokenString)).now();
if (token != null) {
@ -69,7 +69,7 @@ public final class GetLrpTokenCommand implements RemoteApiCommand {
System.out.println(
ofy().load().key(token.getRedemptionHistoryEntry()).now().toHydratedString());
}
}
}
} else {
System.out.println("Token not found.");
}

View file

@ -74,7 +74,7 @@ abstract class ListObjectsCommand implements RemoteApiCommand, ServerSideCommand
@Override
public void run() throws Exception {
ImmutableMap.Builder<String, Object> params = ImmutableMap.<String, Object>builder();
ImmutableMap.Builder<String, Object> params = new ImmutableMap.Builder<>();
if (fields != null) {
params.put(FIELDS_PARAM, fields);
}

View file

@ -177,7 +177,7 @@ public abstract class ListObjectsAction<T extends ImmutableObject> implements Ru
*/
private ImmutableTable<T, String, String>
extractData(ImmutableSet<String> fields, ImmutableSet<T> objects) {
ImmutableTable.Builder<T, String, String> builder = ImmutableTable.builder();
ImmutableTable.Builder<T, String, String> builder = new ImmutableTable.Builder<>();
for (T object : objects) {
Map<String, Object> fieldMap = new HashMap<>();
// Base case of the mapping is to use ImmutableObject's toDiffableFieldMap().