Skip to content

Commit

Permalink
Use optimized List.of instead of Arrays.asList
Browse files Browse the repository at this point in the history
  • Loading branch information
rsvoboda committed Nov 24, 2021
1 parent e39103a commit 41ff661
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.quarkus.kubernetes.config.deployment;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.jboss.logmanager.Level;

Expand Down Expand Up @@ -43,7 +43,7 @@ public void handleAccessToSecrets(KubernetesConfigSourceConfig config,
new KubernetesRoleBuildItem.PolicyRule(
Collections.singletonList(""),
Collections.singletonList("secrets"),
Arrays.asList("get")))));
List.of("get")))));
roleBindingProducer.produce(new KubernetesRoleBindingBuildItem("view-secrets", false));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.quarkus.micrometer.runtime.binder.mpmetrics;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

Expand Down Expand Up @@ -68,7 +67,7 @@ Tag[] convertTags() {
}

public String toString() {
return name + Arrays.asList(tags);
return name + List.of(tags);
}

// Deal with ubiquitous MetricID containing nefarious TreeSet and arbitrary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.nio.file.attribute.FileTime;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -586,15 +585,15 @@ private ClientRepresentation createClient(String clientId, String oidcClientSecr
ClientRepresentation client = new ClientRepresentation();

client.setClientId(clientId);
client.setRedirectUris(Arrays.asList("*"));
client.setRedirectUris(List.of("*"));
client.setPublicClient(false);
client.setSecret(oidcClientSecret);
client.setDirectAccessGrantsEnabled(true);
client.setServiceAccountsEnabled(true);
client.setImplicitFlowEnabled(true);
client.setEnabled(true);
client.setRedirectUris(Arrays.asList("*"));
client.setDefaultClientScopes(Arrays.asList("microprofile-jwt"));
client.setRedirectUris(List.of("*"));
client.setDefaultClientScopes(List.of("microprofile-jwt"));

return client;
}
Expand All @@ -605,7 +604,7 @@ private UserRepresentation createUser(String username, String password, String..
user.setUsername(username);
user.setEnabled(true);
user.setCredentials(new ArrayList<>());
user.setRealmRoles(Arrays.asList(realmRoles));
user.setRealmRoles(List.of(realmRoles));

CredentialRepresentation credential = new CredentialRepresentation();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.resteasy.common.spi;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -99,7 +98,7 @@ public boolean test(MethodInfo methodInfo) {
}

// Types ignored for reflection used by the RESTEasy and SmallRye REST client extensions.
private static final Set<DotName> TYPES_IGNORED_FOR_REFLECTION = new HashSet<>(Arrays.asList(
private static final Set<DotName> TYPES_IGNORED_FOR_REFLECTION = new HashSet<>(List.of(
// Consider adding packages below instead if it makes more sense
));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.quarkus.vault.runtime.config;

import java.util.Arrays;
import java.util.List;

import org.eclipse.microprofile.config.spi.ConfigSource;
import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
Expand All @@ -18,6 +18,6 @@ public VaultConfigSourceProvider(VaultBootstrapConfig vaultBootstrapConfig) {

@Override
public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
return Arrays.asList(new VaultConfigSource(vaultBootstrapConfig));
return List.of(new VaultConfigSource(vaultBootstrapConfig));
}
}

0 comments on commit 41ff661

Please sign in to comment.