diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-11 00:55:49 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-11 00:55:49 +0200 |
commit | 4218e7ad46fd2334ffa5ee1ab1ce6ef58b9e8275 (patch) | |
tree | 6eacda8b0f6666b32846feb44bfe601d26f2be18 /config-model | |
parent | 6557f10a81c6c95eed0be9eead84f026bcf6e958 (diff) |
Arrays.asList => List.of
Diffstat (limited to 'config-model')
50 files changed, 117 insertions, 176 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/MapConfigModelRegistry.java b/config-model/src/main/java/com/yahoo/config/model/MapConfigModelRegistry.java index 8fe1372ef2f..7242d3de1dd 100644 --- a/config-model/src/main/java/com/yahoo/config/model/MapConfigModelRegistry.java +++ b/config-model/src/main/java/com/yahoo/config/model/MapConfigModelRegistry.java @@ -7,7 +7,6 @@ import com.yahoo.config.model.builder.xml.ConfigModelBuilder; import com.yahoo.config.model.builder.xml.ConfigModelId; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; @@ -58,7 +57,7 @@ public class MapConfigModelRegistry extends ConfigModelRegistry { @SafeVarargs @SuppressWarnings("varargs") public static ConfigModelRegistry createFromList(ConfigModelBuilder<? extends ConfigModel> ... builders) { - return new MapConfigModelRegistry(Arrays.asList(builders)); + return new MapConfigModelRegistry(List.of(builders)); } } diff --git a/config-model/src/main/java/com/yahoo/config/model/test/TestUtil.java b/config-model/src/main/java/com/yahoo/config/model/test/TestUtil.java index 94969aa5324..509c10c7fc9 100644 --- a/config-model/src/main/java/com/yahoo/config/model/test/TestUtil.java +++ b/config-model/src/main/java/com/yahoo/config/model/test/TestUtil.java @@ -6,7 +6,6 @@ import com.yahoo.config.model.builder.xml.XmlHelper; import org.w3c.dom.Element; import java.io.StringReader; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -20,7 +19,7 @@ public class TestUtil { public static Element parse(String... xmlLines) { List<String> lines = new ArrayList<>(); lines.add("<?xml version='1.0' encoding='utf-8' ?>"); - lines.addAll(Arrays.asList(xmlLines)); + lines.addAll(List.of(xmlLines)); try { return XmlHelper.getDocument(new StringReader(CollectionUtil.mkString(lines, "\n").replace("'", "\""))).getDocumentElement(); diff --git a/config-model/src/main/java/com/yahoo/schema/RankProfileRegistry.java b/config-model/src/main/java/com/yahoo/schema/RankProfileRegistry.java index 0fddcbd4cc7..4deee1dce9f 100644 --- a/config-model/src/main/java/com/yahoo/schema/RankProfileRegistry.java +++ b/config-model/src/main/java/com/yahoo/schema/RankProfileRegistry.java @@ -4,9 +4,7 @@ package com.yahoo.schema; import com.yahoo.schema.document.SDDocumentType; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -27,7 +25,7 @@ public class RankProfileRegistry { private static final String globalRankProfilesKey = "[global]"; /* These rank profiles can be overridden: 'default' rank profile, as that is documented to work. And 'unranked'. */ - static final Set<String> overridableRankProfileNames = new HashSet<>(Arrays.asList("default", "unranked")); + static final Set<String> overridableRankProfileNames = Set.of("default", "unranked"); public static RankProfileRegistry createRankProfileRegistryWithBuiltinRankProfiles(Schema schema) { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); diff --git a/config-model/src/main/java/com/yahoo/schema/processing/Processing.java b/config-model/src/main/java/com/yahoo/schema/processing/Processing.java index c23d87e9eba..52078326aec 100644 --- a/config-model/src/main/java/com/yahoo/schema/processing/Processing.java +++ b/config-model/src/main/java/com/yahoo/schema/processing/Processing.java @@ -9,8 +9,8 @@ import com.yahoo.vespa.model.container.search.QueryProfiles; import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.deploy.TestProperties; -import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.Set; /** @@ -28,7 +28,7 @@ public class Processing { public Processing(ModelContext.Properties properties) { this.properties = properties; } private Collection<ProcessorFactory> processors() { - return Arrays.asList( + return List.<ProcessorFactory>of( SearchMustHaveDocument::new, UrlFieldValidator::new, BuiltInFieldSets::new, @@ -99,7 +99,7 @@ public class Processing { /** Processors of rank profiles only (those who tolerate and do something useful when the search field is null) */ private Collection<ProcessorFactory> rankProfileProcessors() { - return Arrays.asList( + return List.of( RankProfileTypeSettingsProcessor::new, ReservedFunctionNames::new, RankingExpressionTypeResolver::new); diff --git a/config-model/src/main/java/com/yahoo/schema/processing/UriHack.java b/config-model/src/main/java/com/yahoo/schema/processing/UriHack.java index e4e2ac9f5be..9a4c4038953 100644 --- a/config-model/src/main/java/com/yahoo/schema/processing/UriHack.java +++ b/config-model/src/main/java/com/yahoo/schema/processing/UriHack.java @@ -12,7 +12,6 @@ import com.yahoo.schema.document.SDField; import com.yahoo.schema.document.Stemming; import com.yahoo.vespa.model.container.search.QueryProfiles; -import java.util.Arrays; import java.util.List; /** @@ -21,7 +20,7 @@ import java.util.List; public class UriHack extends Processor { private static final List<String> URL_SUFFIX = - Arrays.asList("scheme", "host", "port", "path", "query", "fragment", "hostname"); + List.of("scheme", "host", "port", "path", "query", "fragment", "hostname"); UriHack(Schema schema, DeployLogger deployLogger, @@ -52,8 +51,7 @@ public class UriHack extends Processor { if (uriField.getDataType() instanceof ArrayDataType) { generatedType = new ArrayDataType(DataType.STRING); } - else if (uriField.getDataType() instanceof WeightedSetDataType) { - WeightedSetDataType wdt = (WeightedSetDataType) uriField.getDataType(); + else if (uriField.getDataType() instanceof WeightedSetDataType wdt) { generatedType = new WeightedSetDataType(DataType.STRING, wdt.createIfNonExistent(), wdt.removeIfZero()); } diff --git a/config-model/src/main/java/com/yahoo/schema/processing/multifieldresolver/IndexCommandResolver.java b/config-model/src/main/java/com/yahoo/schema/processing/multifieldresolver/IndexCommandResolver.java index 111f5384c41..2854824e5b7 100644 --- a/config-model/src/main/java/com/yahoo/schema/processing/multifieldresolver/IndexCommandResolver.java +++ b/config-model/src/main/java/com/yahoo/schema/processing/multifieldresolver/IndexCommandResolver.java @@ -5,8 +5,6 @@ import com.yahoo.config.application.api.DeployLogger; import com.yahoo.schema.document.SDField; import com.yahoo.schema.Schema; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.logging.Level; @@ -16,17 +14,10 @@ import java.util.logging.Level; public class IndexCommandResolver extends MultiFieldResolver { /** Commands which don't have to be harmonized between fields */ - private static List<String> ignoredCommands = new ArrayList<>(); + private static final List<String> ignoredCommands = List.of( "complete-boost", "literal-boost", "highlight"); /** Commands which must be harmonized between fields */ - private static List<String> harmonizedCommands = new ArrayList<>(); - - static { - String[] ignore = { "complete-boost", "literal-boost", "highlight" }; - ignoredCommands.addAll(Arrays.asList(ignore)); - String[] harmonize = { "stemming", "normalizing" }; - harmonizedCommands.addAll(Arrays.asList(harmonize)); - } + private static final List<String> harmonizedCommands = List.of("stemming", "normalizing"); public IndexCommandResolver(String indexName, List<SDField> fields, Schema schema, DeployLogger logger) { super(indexName, fields, schema, logger); @@ -53,8 +44,8 @@ public class IndexCommandResolver extends MultiFieldResolver { ", adding to field " + field.getName()); field.addQueryCommand(command); } else { - deployLogger.logApplicationPackage(Level.WARNING, "All fields going to the same index should have the same query-commands. Field \'" + field.getName() + - "\' doesn't contain command \'" + command+"\'"); + deployLogger.logApplicationPackage(Level.WARNING, "All fields going to the same index should have the same query-commands. Field '" + field.getName() + + "' doesn't contain command '" + command+"'"); } } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java index aa476b1ae39..0a933e7d5ed 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java @@ -7,7 +7,6 @@ import ai.vespa.metrics.set.Vespa9VespaMetricSet; import ai.vespa.metricsproxy.core.VespaMetrics; import ai.vespa.metricsproxy.http.ValuesFetcher; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; @@ -71,7 +70,7 @@ public class MetricsConsumer { } public static MetricsConsumer consumer(String id, MetricSet ... metricSets) { - return new MetricsConsumer(id, new MetricSet(id + "-consumer-metrics", List.of(), Arrays.asList(metricSets))); + return new MetricsConsumer(id, new MetricSet(id + "-consumer-metrics", List.of(), List.of(metricSets))); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/BundleValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/BundleValidator.java index 0a23e25e432..4b4cb1530d4 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/BundleValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/BundleValidator.java @@ -5,7 +5,6 @@ import com.yahoo.config.model.deploy.DeployState; import org.w3c.dom.Document; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -35,7 +34,7 @@ public class BundleValidator extends AbstractBundleValidator { for (Map.Entry<Object,Object> entry : attributes.entrySet()) { mfAttributes.add(entry.getKey().toString()); } - List<String> requiredOSGIHeaders = Arrays.asList( + List<String> requiredOSGIHeaders = List.of( "Bundle-ManifestVersion", "Bundle-Name", "Bundle-SymbolicName", "Bundle-Version"); for (String header : requiredOSGIHeaders) { if (!mfAttributes.contains(header)) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidator.java index e0a43f0988a..ddffe20f725 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidator.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.model.application.validation; import org.w3c.dom.Document; -import java.util.Arrays; +import java.util.List; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.logging.Level; @@ -18,7 +18,7 @@ public class PublicApiBundleValidator extends AbstractBundleValidator { String nonPublicApiAttribute = mf.getMainAttributes().getValue("X-JDisc-Non-PublicApi-Import-Package"); if (nonPublicApiAttribute == null) return; - var nonPublicApisUsed = Arrays.asList(nonPublicApiAttribute.split(",")); + var nonPublicApisUsed = List.of(nonPublicApiAttribute.split(",")); if (! nonPublicApisUsed.isEmpty()) { log(context.deployState(), Level.WARNING, "Jar file '%s' uses non-public Vespa APIs: %s", filename(jar), nonPublicApisUsed); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomGenericTargetBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomGenericTargetBuilder.java index 565cdf3a5f5..b8de223c0cb 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomGenericTargetBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomGenericTargetBuilder.java @@ -9,7 +9,7 @@ import com.yahoo.vespa.model.container.search.searchchain.GenericTarget; import com.yahoo.vespa.model.container.search.searchchain.Searcher; import org.w3c.dom.Element; -import java.util.Arrays; +import java.util.List; import java.util.Map; /** @@ -20,7 +20,7 @@ import java.util.Map; abstract public class DomGenericTargetBuilder<T extends GenericTarget> extends DomChainBuilderBase<Searcher<?>, T> { DomGenericTargetBuilder(Map<String, ComponentsBuilder.ComponentType<?>> outerSearcherTypeByComponentName) { - super(Arrays.asList(ComponentsBuilder.ComponentType.searcher, ComponentsBuilder.ComponentType.federation), + super(List.of(ComponentsBuilder.ComponentType.searcher, ComponentsBuilder.ComponentType.federation), outerSearcherTypeByComponentName); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainBuilder.java index 2eb1127d75b..4ada9e99e5e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainBuilder.java @@ -11,7 +11,7 @@ import com.yahoo.vespa.model.container.search.searchchain.SearchChain; import com.yahoo.vespa.model.container.search.searchchain.Searcher; import org.w3c.dom.Element; -import java.util.Arrays; +import java.util.List; import java.util.Map; /** @@ -21,7 +21,7 @@ import java.util.Map; public class DomSearchChainBuilder extends DomChainBuilderBase<Searcher<?>, SearchChain> { public DomSearchChainBuilder(Map<String, ComponentsBuilder.ComponentType<?>> outerSearcherTypeByComponentName) { - super(Arrays.asList(ComponentsBuilder.ComponentType.searcher, ComponentsBuilder.ComponentType.federation), + super(List.of(ComponentsBuilder.ComponentType.searcher, ComponentsBuilder.ComponentType.federation), outerSearcherTypeByComponentName); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainsBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainsBuilder.java index e05d762d7bc..b48df948358 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainsBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearchChainsBuilder.java @@ -11,7 +11,6 @@ import com.yahoo.vespa.model.container.search.searchchain.SearchChains; import com.yahoo.vespa.model.container.search.searchchain.Searcher; import org.w3c.dom.Element; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -23,7 +22,7 @@ import java.util.Map; public class DomSearchChainsBuilder extends DomChainsBuilder<Searcher<?>, SearchChain, SearchChains> { public DomSearchChainsBuilder() { - super(Arrays.asList(ComponentType.searcher, ComponentType.federation)); + super(List.of(ComponentType.searcher, ComponentType.federation)); } @Override diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java index 099255975b6..0d3d8462376 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java @@ -8,7 +8,6 @@ import com.yahoo.vespa.model.container.ContainerThreadpool; import org.w3c.dom.Element; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; @@ -51,7 +50,7 @@ public class Handler extends Component<Component<?, ?>, ComponentModel> { } public void addServerBindings(BindingPattern... bindings) { - serverBindings.addAll(Arrays.asList(bindings)); + serverBindings.addAll(List.of(bindings)); } public void addServerBindings(Collection<BindingPattern> bps) { serverBindings.addAll(bps); } @@ -61,7 +60,7 @@ public class Handler extends Component<Component<?, ?>, ComponentModel> { } public void addClientBindings(BindingPattern... bindings) { - clientBindings.addAll(Arrays.asList(bindings)); + clientBindings.addAll(List.of(bindings)); } public final Collection<BindingPattern> getServerBindings() { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/Source.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/Source.java index 29e587c6453..f589884cccd 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/Source.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/Source.java @@ -4,9 +4,8 @@ package com.yahoo.vespa.model.container.search.searchchain; import com.yahoo.component.ComponentId; import com.yahoo.component.chain.model.ChainSpecification; import com.yahoo.search.searchchain.model.federation.FederationOptions; -import com.yahoo.config.model.producer.TreeConfigProducer; -import java.util.Arrays; +import java.util.List; /** @@ -51,7 +50,7 @@ public class Source extends GenericTarget { @Override public ChainSpecification getChainSpecification() { return super.getChainSpecification().addInherits( - Arrays.asList(getParentProvider().getComponentId().toSpecification())); + List.of(getParentProvider().getComponentId().toSpecification())); } public ComponentId getGlobalComponentId() { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java index 8a15e61495b..7e14eafc2ee 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java @@ -7,7 +7,6 @@ import com.yahoo.component.ComponentSpecification; import com.yahoo.vespa.model.container.PlatformBundles; import org.w3c.dom.Element; -import java.util.Arrays; import java.util.List; import static com.yahoo.vespa.model.container.component.chain.ProcessingHandler.PROCESSING_HANDLER_CLASS; @@ -39,9 +38,7 @@ public class BundleInstantiationSpecificationBuilder { private static void validate(BundleInstantiationSpecification instSpec) { - List<String> forbiddenClasses = Arrays.asList( - SearchHandler.HANDLER_CLASSNAME, - PROCESSING_HANDLER_CLASS); + List<String> forbiddenClasses = List.of(SearchHandler.HANDLER_CLASSNAME, PROCESSING_HANDLER_CLASS); for (String forbiddenClass: forbiddenClasses) { if (forbiddenClass.equals(instSpec.getClassName())) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidator.java index 53547a1a15b..6dd7278fde8 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidator.java @@ -3,9 +3,6 @@ package com.yahoo.vespa.model.content; import com.yahoo.documentmodel.NewDocumentType; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -13,9 +10,8 @@ import java.util.stream.Collectors; public class ReservedDocumentTypeNameValidator { - public static final List<String> ORDERED_RESERVED_NAMES = Collections.unmodifiableList( - Arrays.asList("and", "false", "id", "not", "null", "or", "true")); - public static final Set<String> RESERVED_NAMES = Collections.unmodifiableSet(new HashSet<>(ORDERED_RESERVED_NAMES)); + public static final List<String> ORDERED_RESERVED_NAMES = List.of("and", "false", "id", "not", "null", "or", "true"); + public static final Set<String> RESERVED_NAMES = Set.copyOf(ORDERED_RESERVED_NAMES); public void validate(Map<String, NewDocumentType> documentDefinitions) { List<String> conflictingNames = documentDefinitions.keySet().stream() diff --git a/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java b/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java index 327d48f9276..4c6a5d0e74b 100644 --- a/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java +++ b/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java @@ -8,7 +8,6 @@ import com.yahoo.config.model.builder.xml.ConfigModelBuilder; import com.yahoo.config.model.builder.xml.ConfigModelId; import org.w3c.dom.Element; -import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -20,7 +19,7 @@ public class GraphMock { public static class BA extends ConfigModelBuilder<A> { public BA() { super(A.class); } - @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); } + @Override public List<ConfigModelId> handlesElements() { return List.of(); } @Override public void doBuild(A model, Element spec, ConfigModelContext modelContext) { } } public static class A extends ConfigModel { @@ -29,7 +28,7 @@ public class GraphMock { public static class BB extends ConfigModelBuilder<B> { public BB() { super(B.class); } - @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); } + @Override public List<ConfigModelId> handlesElements() { return List.of(); } @Override public void doBuild(B model, Element spec, ConfigModelContext modelContext) { } } public static class B extends ConfigModel { @@ -40,7 +39,7 @@ public class GraphMock { public static class BC extends ConfigModelBuilder<C> { public BC() { super(C.class); } - @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); } + @Override public List<ConfigModelId> handlesElements() { return List.of(); } @Override public void doBuild(C model, Element spec, ConfigModelContext modelContext) { } } public static class C extends ConfigModel { @@ -51,7 +50,7 @@ public class GraphMock { public static class BD extends ConfigModelBuilder<D> { public BD() { super(D.class); } - @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); } + @Override public List<ConfigModelId> handlesElements() { return List.of(); } @Override public void doBuild(D model, Element spec, ConfigModelContext modelContext) { } } public static class D extends ConfigModel { @@ -60,7 +59,7 @@ public class GraphMock { public static class BE extends ConfigModelBuilder<E> { public BE() { super(E.class); } - @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); } + @Override public List<ConfigModelId> handlesElements() { return List.of(); } @Override public void doBuild(E model, Element spec, ConfigModelContext modelContext) { } } public static class E extends ConfigModel { diff --git a/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java index 766c19bd01c..596ea99c36d 100644 --- a/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java @@ -6,7 +6,6 @@ import com.yahoo.document.Field; import com.yahoo.document.StructDataType; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -194,7 +193,7 @@ public class IndexSchemaTestCase { private static void assertFlat(Field fieldToFlatten, Field... expectedFields) { List<Field> actual = new LinkedList<>(IndexSchema.flattenField(fieldToFlatten)); - List<Field> expected = new LinkedList<>(Arrays.asList(expectedFields)); + List<Field> expected = new LinkedList<>(List.of(expectedFields)); Collections.sort(actual); Collections.sort(expected); for (Field field : actual) { diff --git a/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java index 628f5042140..b1dc2e66bee 100644 --- a/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java @@ -65,7 +65,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { derive("inheritdiamond", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritdiamond"); } - List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd"); + List<String> files = List.of("grandparent.sd", "mother.sd", "father.sd", "child.sd"); File outDir = newFolder(tmpDir, "out"); for (int startIdx = 0; startIdx < files.size(); ++startIdx) { var builder = new ApplicationBuilder(new TestProperties()); @@ -175,7 +175,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { @Test void testInheritStructDiamondNew() throws IOException, ParseException { String dir = "src/test/derived/declstruct/"; - List<String> files = Arrays.asList("common.sd", "foo.sd", "bar.sd", "foobar.sd"); + List<String> files = List.of("common.sd", "foo.sd", "bar.sd", "foobar.sd"); var builder = new ApplicationBuilder(new TestProperties()); for (String fileName : files) { builder.addSchemaFile(dir + fileName); diff --git a/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java index 8677a14e66b..505960256b8 100644 --- a/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java @@ -15,7 +15,7 @@ import com.yahoo.schema.processing.Processing; import com.yahoo.vespa.model.container.search.QueryProfiles; import org.junit.jupiter.api.Test; -import java.util.Arrays; +import java.util.List; import java.util.Set; import static com.yahoo.schema.processing.AssertIndexingScript.assertIndexing; @@ -50,7 +50,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { derived.getAttributeFields(); // TODO: assert content // Check il script addition - assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }", + assertIndexing(List.of("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }", "clear_state | guard { input a | tokenize | index a_literal; }"), schema); @@ -78,7 +78,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { DerivedConfiguration derived = new DerivedConfiguration(schema, rankProfileRegistry); // Check il script addition - assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }", + assertIndexing(List.of("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }", "clear_state | guard { input a | tokenize | index a_literal; }"), schema); @@ -103,7 +103,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { schema = ApplicationBuilder.buildFromRawSchema(schema, rankProfileRegistry, new QueryProfileRegistry()); new DerivedConfiguration(schema, rankProfileRegistry); - assertIndexing(Arrays.asList("clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }", + assertIndexing(List.of("clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }", "clear_state | guard { input body | tokenize normalize stem:\"BEST\" | summary body | index body; }", "clear_state | guard { input title | tokenize | index title_literal; }", "clear_state | guard { input body | tokenize | index body_literal; }"), diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java index f83892a7a71..8ae6ada7a63 100644 --- a/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java @@ -12,7 +12,6 @@ import com.yahoo.schema.document.SDField; import com.yahoo.schema.document.TemporarySDField; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -73,9 +72,8 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase { } private static void assertOrder(List<String> expectedSearchOrder, List<String> inputNames) { - inputNames.sort(String::compareTo); Map<String, Schema> schemas = createSchemas(); - List<Schema> inputSchemas = inputNames.stream() + List<Schema> inputSchemas = inputNames.stream().sorted() .map(schemas::get) .map(Objects::requireNonNull) .toList(); @@ -100,44 +98,44 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase { @Test void testPerfectOrderingIsKept() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), - Arrays.asList("grandParent", "mother", "father", "daughter", "son", "product", "pc", "alone")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), + List.of("grandParent", "mother", "father", "daughter", "son", "product", "pc", "alone")); } @Test void testOneLevelReordering() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), - Arrays.asList("grandParent", "daughter", "son", "mother", "father", "pc", "product", "alone")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), + List.of("grandParent", "daughter", "son", "mother", "father", "pc", "product", "alone")); } @Test void testMultiLevelReordering() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), - Arrays.asList("daughter", "son", "mother", "father", "grandParent", "pc", "product", "alone")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), + List.of("daughter", "son", "mother", "father", "grandParent", "pc", "product", "alone")); } @Test void testAloneIsKeptInPlaceWithMultiLevelReordering() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), - Arrays.asList("alone", "daughter", "son", "mother", "father", "grandParent", "pc", "product")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), + List.of("alone", "daughter", "son", "mother", "father", "grandParent", "pc", "product")); } @Test void testPartialMultiLevelReordering() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), - Arrays.asList("daughter", "grandParent", "mother", "son", "father", "product", "pc", "alone")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), + List.of("daughter", "grandParent", "mother", "son", "father", "product", "pc", "alone")); } @Test void testMultilevelReorderingAccrossHierarchies() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), - Arrays.asList("daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"), + List.of("daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone")); } @Test void referees_are_ordered_before_referrer() { - assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "accessory-pc", "son"), - Arrays.asList("accessory-pc", "daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone")); + assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "accessory-pc", "son"), + List.of("accessory-pc", "daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone")); } diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java index b487622a928..310706cb0d1 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java @@ -18,7 +18,7 @@ import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression; import com.yahoo.vespa.model.container.search.QueryProfiles; import org.junit.jupiter.api.Test; -import java.util.Arrays; +import java.util.List; import java.util.OptionalDouble; import java.util.OptionalInt; import java.util.OptionalLong; @@ -105,7 +105,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase { @Test void testDerivingFromSimple() throws Exception { - assertIndexing(Arrays.asList("clear_state | guard { input access | attribute access; }", + assertIndexing(List.of("clear_state | guard { input access | attribute access; }", "clear_state | guard { input category | split \";\" | attribute category_arr; }", "clear_state | guard { input category | tokenize | index category; }", "clear_state | guard { input categories_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categories; }", @@ -127,8 +127,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase { @Test void testIndexRewrite() throws Exception { assertIndexing( - Arrays.asList("clear_state | guard { input title_src | lowercase | normalize | " + - " tokenize | index title; }", + List.of("clear_state | guard { input title_src | lowercase | normalize | tokenize | index title; }", "clear_state | guard { input title_src | summary title_s; }"), ApplicationBuilder.buildFromFile("src/test/examples/indexrewrite.sd")); } diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java index 71c91533f54..4053834784f 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java @@ -8,7 +8,7 @@ import com.yahoo.yolean.Exceptions; import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; +import java.util.List; import static com.yahoo.schema.processing.AssertIndexingScript.assertIndexing; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -154,7 +154,7 @@ public class IndexingValidationTestCase extends AbstractExportingTestCase { @Test void testExtraField() throws IOException, ParseException { assertIndexing( - Arrays.asList("clear_state | guard { input my_index | tokenize normalize stem:\"BEST\" | index my_index | summary my_index }", + List.of("clear_state | guard { input my_index | tokenize normalize stem:\"BEST\" | index my_index | summary my_index }", "clear_state | guard { input my_input | tokenize normalize stem:\"BEST\" | index my_extra | summary my_extra }"), ApplicationBuilder.buildFromFile("src/test/examples/indexing_extra.sd")); } diff --git a/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java index 007006bf6d3..87a66046fe5 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java @@ -13,8 +13,8 @@ import com.yahoo.vespa.documentmodel.SummaryTransform; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Iterator; +import java.util.List; import static org.junit.jupiter.api.Assertions.*; @@ -27,7 +27,7 @@ public class PositionTestCase { @Test void inherited_position_zcurve_field_is_not_added_to_document_fieldset() throws Exception { - ApplicationBuilder sb = ApplicationBuilder.createFromFiles(Arrays.asList( + ApplicationBuilder sb = ApplicationBuilder.createFromFiles(List.of( "src/test/examples/position_base.sd", "src/test/examples/position_inherited.sd")); diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java index 0f16330ce11..a602503a71c 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java @@ -21,7 +21,6 @@ import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels; import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -102,12 +101,12 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase { { AttributeFields attributes = new AttributeFields(schema); - verifyProfile(rankProfileRegistry.get(schema, "base"), Arrays.asList("large_f", "large_m"), - Arrays.asList(new Pair<>("rankingExpression(large_f).expressionName", "base.large_f"), new Pair<>("rankingExpression(large_m).expressionName", "base.large_m")), + verifyProfile(rankProfileRegistry.get(schema, "base"), List.of("large_f", "large_m"), + List.of(new Pair<>("rankingExpression(large_f).expressionName", "base.large_f"), new Pair<>("rankingExpression(large_m).expressionName", "base.large_m")), largeExpressions, queryProfiles, models, attributes, properties); - for (String child : Arrays.asList("child_a", "child_b")) { - verifyProfile(rankProfileRegistry.get(schema, child), Arrays.asList("large_f", "large_m", "large_local_f", "large_local_m"), - Arrays.asList(new Pair<>("rankingExpression(large_f).expressionName", child + ".large_f"), new Pair<>("rankingExpression(large_m).expressionName", child + ".large_m"), + for (String child : List.of("child_a", "child_b")) { + verifyProfile(rankProfileRegistry.get(schema, child), List.of("large_f", "large_m", "large_local_f", "large_local_m"), + List.of(new Pair<>("rankingExpression(large_f).expressionName", child + ".large_f"), new Pair<>("rankingExpression(large_m).expressionName", child + ".large_m"), new Pair<>("rankingExpression(large_local_f).expressionName", child + ".large_local_f"), new Pair<>("rankingExpression(large_local_m).expressionName", child + ".large_local_m"), new Pair<>("vespa.rank.firstphase", "rankingExpression(firstphase)"), new Pair<>("rankingExpression(firstphase).expressionName", child + ".firstphase")), largeExpressions, queryProfiles, models, attributes, properties); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java index 19be886d3e5..c5ef2238f9b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.io.IOException; -import java.util.Arrays; import java.util.List; import static org.hamcrest.MatcherAssert.assertThat; @@ -42,7 +41,7 @@ public class PublicApiBundleValidatorTest { assertThat(output, containsString("uses non-public Vespa APIs: [")); // List of packages should be sorted - List<String> packages = Arrays.asList(output.substring(output.indexOf("[") + 1, output.indexOf("]")).split(", ")); + List<String> packages = List.of(output.substring(output.indexOf("[") + 1, output.indexOf("]")).split(", ")); assertThat(packages, hasSize(2)); assertThat(packages, contains("ai.vespa.lib.non_public", "com.yahoo.lib.non_public")); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java index e4b9b45489d..829bd6148a6 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java @@ -54,7 +54,7 @@ public class StartupCommandChangeValidatorTest { private static MockRoot createRootWithChildren(TreeConfigProducer<?>... children) { MockRoot root = new MockRoot(); - Arrays.asList(children).forEach(root::addChild); + List.of(children).forEach(root::addChild); root.freezeModelTopology(); return root; } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java index 91ba97817d6..8778f0c26c0 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java @@ -9,7 +9,6 @@ import com.yahoo.vespa.model.content.utils.ContentClusterUtils; import com.yahoo.vespa.model.content.utils.SchemaBuilder; import com.yahoo.vespa.model.search.DocumentDatabase; -import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -32,15 +31,15 @@ public abstract class ContentClusterFixture { public ContentClusterFixture(String entireSd) throws Exception { currentCluster = new ContentClusterBuilder().build( - ContentClusterUtils.createMockRoot(Arrays.asList(entireSd))); + ContentClusterUtils.createMockRoot(List.of(entireSd))); nextCluster = new ContentClusterBuilder().build( - ContentClusterUtils.createMockRoot(Arrays.asList(entireSd))); + ContentClusterUtils.createMockRoot(List.of(entireSd))); } private static ContentCluster createCluster(String sdContent) throws Exception { return new ContentClusterBuilder().build( ContentClusterUtils.createMockRoot( - Arrays.asList(new SchemaBuilder().content(sdContent).build()))); + List.of(new SchemaBuilder().content(sdContent).build()))); } protected DocumentDatabase currentDb() { @@ -65,7 +64,7 @@ public abstract class ContentClusterFixture { } public void assertValidation(VespaConfigChangeAction exp) { - assertValidation(Arrays.asList(exp)); + assertValidation(List.of(exp)); } public void assertValidation(List<VespaConfigChangeAction> exp) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java index 684bd619ba1..129649ae1fb 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java @@ -8,7 +8,6 @@ import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeActi import org.junit.jupiter.api.Test; import java.time.Instant; -import java.util.Arrays; import java.util.List; import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRefeedAction; @@ -50,7 +49,7 @@ public class DocumentDatabaseChangeValidatorTest { "field f3 type string { indexing: summary } " + "field f4 type array<s> { struct-field s1 { indexing: attribute } }"); Instant.now(); - f.assertValidation(Arrays.asList( + f.assertValidation(List.of( newRestartAction(ClusterSpec.Id.from("test"), "Field 'f1' changed: add attribute aspect"), newRestartAction(ClusterSpec.Id.from("test"), diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java index 0e3d74a6995..26a4f532362 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java @@ -14,7 +14,6 @@ import com.yahoo.vespa.model.application.validation.change.VespaRefeedAction; import org.junit.jupiter.api.Test; import java.time.Instant; -import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.Set; @@ -108,7 +107,7 @@ public class DocumentTypeChangeValidatorTest { "field f2 type string { indexing: summary } field f1 type int { indexing: summary }"); Instant.now(); Instant.now(); - f.assertValidation(Arrays.asList(newRefeedAction(ClusterSpec.Id.from("test"), ValidationId.fieldTypeChange, "Field 'f1' changed: data type: 'string' -> 'int'"), + f.assertValidation(List.of(newRefeedAction(ClusterSpec.Id.from("test"), ValidationId.fieldTypeChange, "Field 'f1' changed: data type: 'string' -> 'int'"), newRefeedAction(ClusterSpec.Id.from("test"), ValidationId.fieldTypeChange, "Field 'f2' changed: data type: 'int' -> 'string'"))); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java index 6b58cac3f6c..cd54a20523f 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java @@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; public class IndexingScriptChangeValidatorTest { @@ -126,7 +125,7 @@ public class IndexingScriptChangeValidatorTest { void requireThatMultipleChangesRequireReindexing() throws Exception { new Fixture(FIELD + " { indexing: index } " + FIELD_F2 + " { indexing: index }", FIELD + " { indexing: index \n stemming: none } " + FIELD_F2 + " { indexing: index \n normalizing: none }"). - assertValidation(Arrays.asList(expectedReindexingAction("f1", "stemming: 'best' -> 'none'", + assertValidation(List.of(expectedReindexingAction("f1", "stemming: 'best' -> 'none'", "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }", "{ input f1 | tokenize normalize | index f1; }"), expectedReindexingAction("f2", "normalizing: 'ACCENT' -> 'NONE'", diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java index fac82f3e675..924419daeae 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java @@ -26,7 +26,6 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; import java.util.Set; @@ -876,8 +875,8 @@ public class ContentBuilderTest extends DomBuilderTest { VespaModel m = new VespaModelCreatorWithMockPkg(new MockApplicationPackage.Builder() .withHosts(getHosts()) .withServices(combined) - .withSchemas(Arrays.asList(MockApplicationPackage.MUSIC_SCHEMA, - MockApplicationPackage.BOOK_SCHEMA)) + .withSchemas(List.of(MockApplicationPackage.MUSIC_SCHEMA, + MockApplicationPackage.BOOK_SCHEMA)) .build()) .create(); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java index 853cfdd9429..0e616661191 100755 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java @@ -18,7 +18,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.w3c.dom.Element; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -112,7 +111,7 @@ public class DomAdminV2BuilderTest extends DomBuilderTest { @Test void multitenant() { - List<ConfigServerSpec> configServerSpecs = Arrays.asList( + List<ConfigServerSpec> configServerSpecs = List.of( new TestProperties.Spec("test1", 19070, 2181), new TestProperties.Spec("test2", 19070, 2181), new TestProperties.Spec("test3", 19070, 2181)); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java index 764e31fe13a..c7525dec6a3 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java @@ -8,7 +8,7 @@ import com.yahoo.vespa.model.search.Tuning; import org.junit.jupiter.api.Test; import org.w3c.dom.Element; -import java.util.Arrays; +import java.util.List; import static org.junit.jupiter.api.Assertions.*; @@ -22,7 +22,7 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest { private static Element parseXml(String... xmlLines) { return parse("<tuning>", "<searchnode>", - CollectionUtil.mkString(Arrays.asList(xmlLines), "\n"), + CollectionUtil.mkString(List.of(xmlLines), "\n"), "</searchnode>", "</tuning>"); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java index 6b384269910..56f492f3fca 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java @@ -20,7 +20,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.w3c.dom.Element; -import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -98,7 +97,7 @@ public class DomSchemaChainsBuilderTest extends DomBuilderTest { @Test void ensureSearchChainsExists() { - for (String id : Arrays.asList("provider:1", "source:1@provider:1", "default")) { + for (String id : List.of("provider:1", "source:1@provider:1", "default")) { assertNotNull(getSearchChain(id), "Missing search chain " + id); } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java index 5e6863360e7..4e14fbcd671 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java @@ -21,7 +21,6 @@ import com.yahoo.vespa.model.container.configserver.option.CloudConfigOptions; import com.yahoo.vespa.model.container.xml.ConfigServerContainerModelBuilder; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.function.Function; @@ -44,7 +43,7 @@ public class ConfigserverClusterTest { @Test void zookeeperConfig_only_config_servers_set_hosted() { - TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of()); + TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of()); ZookeeperServerConfig config = getConfig(ZookeeperServerConfig.class, testOptions); assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::hostname, "cfg1", "localhost", "cfg3"); assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::id, 0, 1, 2); @@ -55,7 +54,7 @@ public class ConfigserverClusterTest { @Test void zookeeperConfig_with_config_servers_and_zk_ids_hosted() { - TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of(4, 2, 3)); + TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(4, 2, 3)); ZookeeperServerConfig config = getConfig(ZookeeperServerConfig.class, testOptions); assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::hostname, "cfg1", "localhost", "cfg3"); assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::id, 4, 2, 3); @@ -66,7 +65,7 @@ public class ConfigserverClusterTest { @Test void zookeeperConfig_self_hosted() { final boolean hostedVespa = false; - TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), Arrays.asList(4, 2, 3), hostedVespa); + TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(4, 2, 3), hostedVespa); ZookeeperServerConfig config = getConfig(ZookeeperServerConfig.class, testOptions); assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::hostname, "cfg1", "localhost", "cfg3"); assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::id, 4, 2, 3); @@ -78,7 +77,7 @@ public class ConfigserverClusterTest { @Test void zookeeperConfig_uneven_number_of_config_servers_and_zk_ids() { assertThrows(IllegalArgumentException.class, () -> { - TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of(1)); + TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(1)); getConfig(ZookeeperServerConfig.class, testOptions); }); } @@ -86,7 +85,7 @@ public class ConfigserverClusterTest { @Test void zookeeperConfig_negative_zk_id() { assertThrows(IllegalArgumentException.class, () -> { - TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of(1, 2, -1)); + TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(1, 2, -1)); getConfig(ZookeeperServerConfig.class, testOptions); }); } @@ -135,7 +134,7 @@ public class ConfigserverClusterTest { private static <T> void assertZookeeperServerProperty( List<ZookeeperServerConfig.Server> zkServers, Function<ZookeeperServerConfig.Server, T> propertyMapper, T... expectedProperties) { List<T> actualPropertyValues = zkServers.stream().map(propertyMapper).toList(); - List<T> expectedPropertyValues = Arrays.asList(expectedProperties); + List<T> expectedPropertyValues = List.of(expectedProperties); assertEquals(expectedPropertyValues, actualPropertyValues); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java index 10adca12f91..46097da434e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java @@ -19,13 +19,12 @@ import org.w3c.dom.Element; import org.xml.sax.SAXException; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Set; import java.util.logging.Level; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -218,18 +217,17 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase { } private String verifyLogMessage(TestLogger logger, String... invalidOptions) { - List<String> strings = Arrays.asList(invalidOptions.clone()); + List<String> strings = List.of(invalidOptions); // Verify that nothing is logged if there are no invalid options if (strings.isEmpty()) { - assertEquals(0, logger.msgs.size(), logger.msgs.size() > 0 ? logger.msgs.get(0).getSecond() : ""); + assertEquals(0, logger.msgs.size(), !logger.msgs.isEmpty() ? logger.msgs.get(0).getSecond() : ""); return null; } - assertTrue(logger.msgs.size() > 0, "Expected 1 or more log messages for invalid JM options, got none"); + assertFalse(logger.msgs.isEmpty(), "Expected 1 or more log messages for invalid JM options, got none"); Pair<Level, String> firstOption = logger.msgs.get(0); assertEquals(Level.WARNING, firstOption.getFirst()); - Collections.sort(strings); return firstOption.getSecond(); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java index 4cf950e319d..96e1f2edf76 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java @@ -42,7 +42,6 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import com.yahoo.yolean.Exceptions; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Map; @@ -70,7 +69,7 @@ public class ContentClusterTest extends ContentBaseTest { @Test void testHierarchicRedundancy() { - ContentCluster cc = parse("" + + ContentCluster cc = parse( "<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <engine>" + @@ -1102,7 +1101,7 @@ public class ContentClusterTest extends ContentBaseTest { assertEquals(2, config.cluster().size()); - assertClusterHasBucketSpaceMappings(config, "foo_c", Arrays.asList("bunnies", "hares"), List.of()); + assertClusterHasBucketSpaceMappings(config, "foo_c", List.of("bunnies", "hares"), List.of()); assertClusterHasBucketSpaceMappings(config, "bar_c", List.of(), List.of("rabbits")); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java index 55ec9f4efe2..8c08b9054a4 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java @@ -12,7 +12,6 @@ import com.yahoo.vespa.model.content.utils.DocType; import com.yahoo.vespa.model.content.utils.SchemaBuilder; import org.junit.jupiter.api.Test; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static com.yahoo.config.model.test.TestUtil.joinLines; @@ -60,12 +59,12 @@ public class ContentSchemaClusterTest { private static ContentClusterBuilder createClusterBuilderWithGlobalType() { return new ContentClusterBuilder() - .docTypes(Arrays.asList(DocType.indexGlobal("global"), DocType.index("regular"))); + .docTypes(List.of(DocType.indexGlobal("global"), DocType.index("regular"))); } private static ContentClusterBuilder createClusterBuilderWithOnlyDefaultTypes() { return new ContentClusterBuilder() - .docTypes(Arrays.asList(DocType.index("marve"), DocType.index("fleksnes"))); + .docTypes(List.of(DocType.index("marve"), DocType.index("fleksnes"))); } private static ProtonConfig getProtonConfig(ContentCluster cluster) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java index b41d92bd63f..901c307723e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java @@ -21,7 +21,6 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import org.junit.jupiter.api.Test; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -489,7 +488,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { private DocprocClusterSpec(String name, DocprocChainSpec ... chains) { this.name = name; - this.chains.addAll(Arrays.asList(chains)); + this.chains.addAll(List.of(chains)); } } @@ -500,7 +499,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { private DocprocChainSpec(String name, String ... inherits) { this.name = name; - this.inherits.addAll(Arrays.asList(inherits)); + this.inherits.addAll(List.of(inherits)); } } @@ -542,7 +541,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } public static List<String> generateSchemas(String ... sdNames) { - return generateSchemas(Arrays.asList(sdNames)); + return generateSchemas(List.of(sdNames)); } public static List<String> generateSchemas(List<String> sdNames) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java index 68856fe3488..2fb9a67a9ae 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.model.content; import com.yahoo.documentmodel.NewDocumentType; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -45,7 +44,7 @@ public class ReservedDocumentTypeNameValidatorTest { @Test void validation_is_case_insensitive() { ReservedDocumentTypeNameValidator validator = new ReservedDocumentTypeNameValidator(); - Map<String, NewDocumentType> orderedDocTypes = new TreeMap<>(asDocTypeMapping(Arrays.asList("NULL", "True", "anD"))); + Map<String, NewDocumentType> orderedDocTypes = new TreeMap<>(asDocTypeMapping(List.of("NULL", "True", "anD"))); try { validator.validate(orderedDocTypes); fail(); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java index 3de46f00db5..06794a3c1f3 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java @@ -5,7 +5,6 @@ import com.yahoo.documentmodel.NewDocumentType; import org.junit.jupiter.api.Test; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -26,14 +25,14 @@ public class TopologicalDocumentTypeSorterTest { @Test void require_that_types_with_references_are_sorted_in_topological_order() { - assertOrder(Arrays.asList("b", "a"), new DocumentTypesBuilder() + assertOrder(List.of("b", "a"), new DocumentTypesBuilder() .add("a", List.of("b")) .add("b")); - assertOrder(Arrays.asList("c", "b", "a"), new DocumentTypesBuilder() - .add("a", Arrays.asList("b", "c")) + assertOrder(List.of("c", "b", "a"), new DocumentTypesBuilder() + .add("a", List.of("b", "c")) .add("b", List.of("c")) .add("c")); - assertOrder(Arrays.asList("b", "a", "d", "c"), new DocumentTypesBuilder() + assertOrder(List.of("b", "a", "d", "c"), new DocumentTypesBuilder() .add("a", List.of("b")) .add("b") .add("c", List.of("d")) diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java index 3bd7b7a4c1a..1043ddd2c0b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java @@ -6,9 +6,7 @@ import com.yahoo.text.XML; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -35,7 +33,7 @@ public class GlobalDistributionBuilderTest { " <document type=\"" + GLOBAL_2.getName() + "\" global=\"true\"/>" + "</documents>"; - Set<NewDocumentType> expectedResult = new HashSet<>(Arrays.asList(GLOBAL_1, GLOBAL_2)); + Set<NewDocumentType> expectedResult = Set.of(GLOBAL_1, GLOBAL_2); Set<NewDocumentType> actualResult = builder.build(new ModelElement(XML.getDocument(documentsElement).getDocumentElement())); assertEquals(expectedResult, actualResult); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java index 61ce5172ceb..277b07023e6 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java @@ -7,7 +7,6 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster; import java.util.Arrays; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import static com.yahoo.config.model.test.TestUtil.joinLines; @@ -21,7 +20,7 @@ public class ContentClusterBuilder { private String name = "mycluster"; private int redundancy = 1; private int searchableCopies = 1; - private List<DocType> docTypes = Arrays.asList(DocType.index("test")); + private List<DocType> docTypes = List.of(DocType.index("test")); private String groupXml = getSimpleGroupXml(); private Optional<String> dispatchXml = Optional.empty(); private Optional<Double> protonDiskLimit = Optional.empty(); @@ -54,8 +53,8 @@ public class ContentClusterBuilder { } public ContentClusterBuilder docTypes(String ... docTypes) { - this.docTypes = Arrays.asList(docTypes).stream(). - map(type -> DocType.index(type)). + this.docTypes = Arrays.stream(docTypes). + map(DocType::index). toList(); return this; } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java index 3ffb33a47c8..ce05fa27e2e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java @@ -1,7 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content.utils; -import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -46,7 +45,7 @@ public class DocType { } public static String listToXml(DocType... docTypes) { - return listToXml(Arrays.asList(docTypes)); + return listToXml(List.of(docTypes)); } public static String listToXml(List<DocType> docTypes) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java index 304f3dc426f..55ad9149a17 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java @@ -38,8 +38,7 @@ public class SchemaBuilder { } public static List<String> createSchemas(String ... docTypes) { - return Arrays.asList(docTypes) - .stream() + return Arrays.stream(docTypes) .map(type -> new SchemaBuilder().name(type).build()) .toList(); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java index 7efacd6b5ad..e17db551798 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java @@ -12,7 +12,6 @@ import com.yahoo.vespa.model.search.SearchCluster; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -181,7 +180,7 @@ public class SchemaTester { } public static List<String> generateSchemas(String schemaContent, String rankProfile, String ... schemaNames) { - return generateSchemas(schemaContent, rankProfile, Arrays.asList(schemaNames)); + return generateSchemas(schemaContent, rankProfile, List.of(schemaNames)); } public static List<String> generateSchemas(String schemaContent, String rankProfile, List<String> schemaNames) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java index 41003f03c0d..b9be56d8d69 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java @@ -10,7 +10,6 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -50,7 +49,7 @@ public class ApiConfigModel extends ConfigModel { @Override public List<ConfigModelId> handlesElements() { - return Arrays.asList(ConfigModelId.fromName("api")); + return List.of(ConfigModelId.fromName("api")); } @Override diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java index 61bd3d885f5..d9be865bc7d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java @@ -10,7 +10,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -20,8 +19,8 @@ import java.util.List; */ public class SimpleConfigModel extends ConfigModel implements TestApi { - private List<SimpleService> simpleServices = new ArrayList<>(); - private List<ParentService> parentServices = new ArrayList<>(); + private final List<SimpleService> simpleServices = new ArrayList<>(); + private final List<ParentService> parentServices = new ArrayList<>(); public SimpleConfigModel(ConfigModelContext modelContext) { super(modelContext); @@ -43,7 +42,7 @@ public class SimpleConfigModel extends ConfigModel implements TestApi { @Override public List<ConfigModelId> handlesElements() { - return Arrays.asList(ConfigModelId.fromName("simple")); + return List.of(ConfigModelId.fromName("simple")); } @Override @@ -54,11 +53,10 @@ public class SimpleConfigModel extends ConfigModel implements TestApi { NodeList childNodes = spec.getChildNodes(); for (int i=0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); - if (! (child instanceof Element)) { + if (! (child instanceof Element e)) { // skip #text and #comment nodes continue; } - Element e = (Element)child; String service = e.getTagName(); if (service.equals("simpleservice")) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java index b9bc34688b7..ce373e558ef 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java @@ -2,7 +2,6 @@ package com.yahoo.vespa.model.test.utils; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -50,7 +49,7 @@ public class ApplicationPackageUtils { } public static List<String> generateSchemas(String ... sdNames) { - return generateSchemas(Arrays.asList(sdNames)); + return generateSchemas(List.of(sdNames)); } public static List<String> generateSchemas(List<String> sdNames) { |