Skip to content
Permalink
Browse files
8281289: Improve with List.copyOf
Reviewed-by: jnimeh, hchao
  • Loading branch information
XueleiFan committed Feb 5, 2022
1 parent 48523b0 commit 42e272e181f188c89fa88f144715f19235943fca
Showing 1 changed file with 2 additions and 5 deletions.
@@ -29,7 +29,6 @@
import java.util.Map;
import java.util.List;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -391,8 +390,7 @@ public final void setServerNames(List<SNIServerName> serverNames) {
public final List<SNIServerName> getServerNames() {
if (sniNames != null) {
if (!sniNames.isEmpty()) {
return Collections.<SNIServerName>unmodifiableList(
new ArrayList<>(sniNames.values()));
return List.copyOf(sniNames.values());
} else {
return Collections.<SNIServerName>emptyList();
}
@@ -466,8 +464,7 @@ public final void setSNIMatchers(Collection<SNIMatcher> matchers) {
public final Collection<SNIMatcher> getSNIMatchers() {
if (sniMatchers != null) {
if (!sniMatchers.isEmpty()) {
return Collections.<SNIMatcher>unmodifiableList(
new ArrayList<>(sniMatchers.values()));
return List.copyOf(sniMatchers.values());
} else {
return Collections.<SNIMatcher>emptyList();
}

1 comment on commit 42e272e

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 42e272e Feb 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.