From 76a89b62274060452022ddf24a7685ee2f380cb4 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 12 Apr 2024 08:30:35 +0200 Subject: Replace all usages of Arrays.asList with List.of where possible. --- vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java | 3 +-- vespajlib/src/main/java/com/yahoo/system/CommandLineParser.java | 4 ++-- vespajlib/src/main/java/com/yahoo/tensor/Tensor.java | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'vespajlib/src/main') diff --git a/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java b/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java index 7f70256233e..1f215f9d90e 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java +++ b/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java @@ -51,8 +51,7 @@ public class CollectionUtil { * Returns true if the contents of the two given collections are equal, ignoring order. */ public static boolean equalContentsIgnoreOrder(Collection c1, Collection c2) { - return c1.size() == c2.size() && - c1.containsAll(c2); + return c1.size() == c2.size() && c1.containsAll(c2); } /** diff --git a/vespajlib/src/main/java/com/yahoo/system/CommandLineParser.java b/vespajlib/src/main/java/com/yahoo/system/CommandLineParser.java index 704fe9d56c3..12b435111e3 100644 --- a/vespajlib/src/main/java/com/yahoo/system/CommandLineParser.java +++ b/vespajlib/src/main/java/com/yahoo/system/CommandLineParser.java @@ -39,12 +39,12 @@ public class CommandLineParser { } public CommandLineParser(String[] cmds) { - inputStrings = Arrays.asList(cmds); + inputStrings = List.of(cmds); } public CommandLineParser(String progname, String[] cmds) { this.progname=progname; - inputStrings = Arrays.asList(cmds); + inputStrings = List.of(cmds); } /** diff --git a/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java b/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java index f5ec63ab4e9..d225d6f4641 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java @@ -23,7 +23,6 @@ import com.yahoo.tensor.functions.Expand; import com.yahoo.tensor.impl.Label; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -169,7 +168,7 @@ public interface Tensor { /** Aggregates cells over a set of dimensions, or over all dimensions if no dimensions are specified */ default Tensor reduce(Reduce.Aggregator aggregator, String ... dimensions) { - return new Reduce<>(new ConstantTensor<>(this), aggregator, Arrays.asList(dimensions)).evaluate(); + return new Reduce<>(new ConstantTensor<>(this), aggregator, List.of(dimensions)).evaluate(); } /** Aggregates cells over a set of dimensions, or over all dimensions if no dimensions are specified */ default Tensor reduce(Reduce.Aggregator aggregator, List dimensions) { -- cgit v1.2.3