summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 15:09:55 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 21:04:22 +0200
commit2d6bbe0b8bff09d105b77161c1d26a00ce43bf0c (patch)
treef9948a9904d837960887e81a956b29f92d918002 /client
parent6923743ed320ce339727ad57f6fc2da5f82f5e3f (diff)
Unify on List.of
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/ai/vespa/client/dsl/Sources.java3
-rw-r--r--client/src/test/java/ai/vespa/client/dsl/QTest.java12
2 files changed, 7 insertions, 8 deletions
diff --git a/client/src/main/java/ai/vespa/client/dsl/Sources.java b/client/src/main/java/ai/vespa/client/dsl/Sources.java
index b6dd1b06536..cecf27aa240 100644
--- a/client/src/main/java/ai/vespa/client/dsl/Sources.java
+++ b/client/src/main/java/ai/vespa/client/dsl/Sources.java
@@ -3,7 +3,6 @@ package ai.vespa.client.dsl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -19,7 +18,7 @@ public class Sources {
}
Sources(Select select, String searchDefinition) {
- this(select, Collections.singletonList(searchDefinition));
+ this(select, List.of(searchDefinition));
}
Sources(Select select, String searchDefinition, String... others) {
diff --git a/client/src/test/java/ai/vespa/client/dsl/QTest.java b/client/src/test/java/ai/vespa/client/dsl/QTest.java
index 3dbf714ed62..7673d0ff717 100644
--- a/client/src/test/java/ai/vespa/client/dsl/QTest.java
+++ b/client/src/test/java/ai/vespa/client/dsl/QTest.java
@@ -4,9 +4,9 @@ package ai.vespa.client.dsl;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -498,7 +498,7 @@ class QTest {
@Test
void use_contains_instead_of_contains_equiv_when_input_size_is_1() {
- String q = Q.p("f1").containsEquiv(Collections.singletonList("p1"))
+ String q = Q.p("f1").containsEquiv(List.of("p1"))
.build();
assertEquals(q, "yql=select * from sources * where f1 contains \"p1\"");
@@ -506,16 +506,16 @@ class QTest {
@Test
void contains_phrase_near_onear_equiv_empty_list_should_throw_illegal_argument_exception() {
- assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsPhrase(Collections.emptyList())
+ assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsPhrase(List.of())
.build());
- assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsNear(Collections.emptyList())
+ assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsNear(List.of())
.build());
- assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsOnear(Collections.emptyList())
+ assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsOnear(List.of())
.build());
- assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsEquiv(Collections.emptyList())
+ assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsEquiv(List.of())
.build());
}