diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-12 08:30:35 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-12 08:39:04 +0200 |
commit | 76a89b62274060452022ddf24a7685ee2f380cb4 (patch) | |
tree | ef924603de22efd026f519ab31fd8f5a6ff60f2f /predicate-search | |
parent | 7e7ebf7b527be1f163d497a41898e2252d878fe7 (diff) |
Replace all usages of Arrays.asList with List.of where possible.
Diffstat (limited to 'predicate-search')
10 files changed, 61 insertions, 69 deletions
diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnalyzerTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnalyzerTest.java index 401c006b273..bc330a7d1f3 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnalyzerTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnalyzerTest.java @@ -6,7 +6,8 @@ import com.yahoo.document.predicate.Predicate; import com.yahoo.document.predicate.PredicateOperator; import org.junit.jupiter.api.Test; -import java.util.Arrays; + +import java.util.List; import static com.yahoo.document.predicate.Predicates.and; import static com.yahoo.document.predicate.Predicates.feature; @@ -208,7 +209,7 @@ public class PredicateTreeAnalyzerTest { } private static FeatureConjunction conj(Predicate... operands) { - return new FeatureConjunction(Arrays.asList(operands)); + return new FeatureConjunction(List.of(operands)); } private static void assertSizeMapContains(PredicateTreeAnalyzerResult r, PredicateSelector selector, int expectedValue) { @@ -217,18 +218,13 @@ public class PredicateTreeAnalyzerTest { assertEquals(expectedValue, actualValue.intValue()); } - private static class PredicateSelector { - public final Predicate predicate; - - public PredicateSelector(Predicate predicate) { - this.predicate = predicate; - } + private record PredicateSelector(Predicate predicate) { public PredicateSelector child(int index) { - PredicateOperator op = (PredicateOperator) predicate; - return new PredicateSelector(op.getOperands().get(index)); + PredicateOperator op = (PredicateOperator) predicate; + return new PredicateSelector(op.getOperands().get(index)); + } } - } private static PredicateSelector pred(Predicate p) { return new PredicateSelector(p); diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnnotatorTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnnotatorTest.java index 18cdc4defff..237aeda4fb3 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnnotatorTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/annotator/PredicateTreeAnnotatorTest.java @@ -13,7 +13,6 @@ import com.yahoo.search.predicate.index.IntervalWithBounds; import com.yahoo.search.predicate.index.conjunction.IndexableFeatureConjunction; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -229,7 +228,7 @@ public class PredicateTreeAnnotatorTest { long hash = PredicateHash.hash64(feature); List<Integer> actualIntervals = r.intervalMap.get(hash); assertNotNull(actualIntervals); - assertArrayEquals(Ints.toArray(Arrays.asList(expectedIntervals)), Ints.toArray(actualIntervals)); + assertArrayEquals(Ints.toArray(List.of(expectedIntervals)), Ints.toArray(actualIntervals)); } private static void assertBoundsContains(PredicateTreeAnnotations r, String feature, IntervalWithBounds expectedBounds) { @@ -258,11 +257,11 @@ public class PredicateTreeAnnotatorTest { private static FeatureRange range(String key, Long lower, Long upper, RangePartition... partitions) { FeatureRange range = new FeatureRange(key, lower, upper); - Arrays.asList(partitions).forEach(range::addPartition); + List.of(partitions).forEach(range::addPartition); return range; } private static FeatureConjunction conj(Predicate... operands) { - return new FeatureConjunction(Arrays.asList(operands)); + return new FeatureConjunction(List.of(operands)); } } diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/CachedPostingListCounterTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/CachedPostingListCounterTest.java index 68f692e3119..cf7e286f89f 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/CachedPostingListCounterTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/CachedPostingListCounterTest.java @@ -6,7 +6,6 @@ import org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap; import org.junit.jupiter.api.Test; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertArrayEquals; @@ -107,12 +106,12 @@ public class CachedPostingListCounterTest { } private static List<PostingList> list(PostingList... postingLists) { - return Arrays.asList(postingLists); + return List.of(postingLists); } private static PostingList postingList(Integer... docIds) { PostingList postingList = mock(PostingList.class); - when(postingList.getDocIds()).thenReturn(Ints.toArray(Arrays.asList((docIds)))); + when(postingList.getDocIds()).thenReturn(Ints.toArray(List.of((docIds)))); return postingList; } diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/IntervalPostingListTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/IntervalPostingListTest.java index 8b2a5cc1d7e..26f191e13b6 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/IntervalPostingListTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/IntervalPostingListTest.java @@ -4,7 +4,8 @@ package com.yahoo.search.predicate.index; import com.yahoo.search.predicate.SubqueryBitmap; import org.junit.jupiter.api.Test; -import java.util.Arrays; + +import java.util.List; import static org.junit.jupiter.api.Assertions.*; @@ -13,9 +14,9 @@ public class IntervalPostingListTest { @Test void requireThatPostingListCanIterate() { PredicateIntervalStore.Builder builder = new PredicateIntervalStore.Builder(); - int ref1 = builder.insert(Arrays.asList(0x1ffff)); - int ref2 = builder.insert(Arrays.asList(0x1ffff)); - int ref3 = builder.insert(Arrays.asList(0x10001, 0x2ffff)); + int ref1 = builder.insert(List.of(0x1ffff)); + int ref2 = builder.insert(List.of(0x1ffff)); + int ref3 = builder.insert(List.of(0x10001, 0x2ffff)); IntervalPostingList postingList = new IntervalPostingList( builder.build(), new int[]{2, 4, 6}, new int[]{ref1, ref2, ref3}, SubqueryBitmap.ALL_SUBQUERIES); assertEquals(-1, postingList.getDocId()); diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateIntervalStoreTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateIntervalStoreTest.java index bfc4635aa51..c02c18ae1d7 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateIntervalStoreTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateIntervalStoreTest.java @@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static com.yahoo.search.predicate.serialization.SerializationTestHelper.assertSerializationDeserializationMatches; @@ -49,9 +48,9 @@ public class PredicateIntervalStoreTest { @Test void requireThatSerializationAndDeserializationRetainIntervals() throws IOException { PredicateIntervalStore.Builder builder = new PredicateIntervalStore.Builder(); - builder.insert(Arrays.asList(0x00010001, 0x00020002)); - builder.insert(Arrays.asList(0x00010001, 0x00020002, 0x00030003)); - builder.insert(Arrays.asList(0x0fffffff, 0x00020002, 0x00030003)); + builder.insert(List.of(0x00010001, 0x00020002)); + builder.insert(List.of(0x00010001, 0x00020002, 0x00030003)); + builder.insert(List.of(0x0fffffff, 0x00020002, 0x00030003)); PredicateIntervalStore store = builder.build(); assertSerializationDeserializationMatches( store, PredicateIntervalStore::writeToOutputStream, PredicateIntervalStore::fromInputStream); @@ -60,8 +59,8 @@ public class PredicateIntervalStoreTest { @Test void requireThatEqualIntervalListsReturnsSameReference() { PredicateIntervalStore.Builder builder = new PredicateIntervalStore.Builder(); - List<Integer> intervals1 = Arrays.asList(0x00010001, 0x00020002); - List<Integer> intervals2 = Arrays.asList(0x00010001, 0x00020002); + List<Integer> intervals1 = List.of(0x00010001, 0x00020002); + List<Integer> intervals2 = List.of(0x00010001, 0x00020002); int ref1 = builder.insert(intervals1); int ref2 = builder.insert(intervals2); PredicateIntervalStore store = builder.build(); diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateRangeTermExpanderTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateRangeTermExpanderTest.java index 3c0a2290817..0b8076b310c 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateRangeTermExpanderTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateRangeTermExpanderTest.java @@ -4,8 +4,8 @@ package com.yahoo.search.predicate.index; import com.yahoo.document.predicate.PredicateHash; 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.*; @@ -16,7 +16,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatSmallRangeIsExpanded() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=40-49", "key=0-99", "key=0-999", @@ -46,7 +46,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatLargeRangeIsExpanded() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=123456789012345670-123456789012345679", "key=123456789012345600-123456789012345699", "key=123456789012345000-123456789012345999", @@ -86,7 +86,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatSmallNegativeRangeIsExpanded() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=-49-40", "key=-99-0", "key=-999-0", @@ -126,7 +126,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatMinRangeMinus9IsExpanded() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=-9223372036854775799-9223372036854775790", "key=-9223372036854775799-9223372036854775700").iterator(); expander.expand("key", -9223372036854775799L, range -> assertEquals(PredicateHash.hash64(expectedLabels.next()), range), @@ -150,7 +150,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatSmallRangeIsExpandedInArity2() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(2); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=42-43", "key=40-43", "key=40-47", @@ -225,7 +225,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatSmallNegativeRangeIsExpandedInArity2() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(2); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=-43-42", "key=-43-40", "key=-47-40", @@ -300,7 +300,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatUpperBoundIsUsed() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10, -99, 9999); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=40-49", "key=0-99", "key=0-999", @@ -316,7 +316,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatLowerBoundIsUsed() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10, -9999, 99); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=-49-40", "key=-99-0", "key=-999-0", @@ -339,7 +339,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatUpperAndLowerBoundGreaterThan0Works() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10, 100, 9999); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=140-149", "key=100-199", "key=0-999", @@ -355,7 +355,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatSearchCloseToUnevenUpperBoundIsSensible() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10, -99, 1234); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=40-49", "key=0-99", "key=0-999", @@ -371,7 +371,7 @@ public class PredicateRangeTermExpanderTest { @Test void requireThatSearchCloseToMaxUnevenUpperBoundIsSensible() { PredicateRangeTermExpander expander = new PredicateRangeTermExpander(10, 0, 9223372036854771234L); - Iterator<String> expectedLabels = Arrays.asList( + Iterator<String> expectedLabels = List.of( "key=9223372036854770000-9223372036854770009", "key=9223372036854770000-9223372036854770099", "key=9223372036854770000-9223372036854770999").iterator(); diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateSearchTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateSearchTest.java index 62dde7ac585..d520980193e 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateSearchTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/PredicateSearchTest.java @@ -32,7 +32,7 @@ public class PredicateSearchTest { entry(0, 0x000100ff), entry(1, 0x00010001, 0x000200ff), entry(2, 0x00010042))); - assertEquals(Arrays.asList(new Hit(0), new Hit(1)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0), new Hit(1)).toString(), search.stream().toList().toString()); } @Test @@ -43,7 +43,7 @@ public class PredicateSearchTest { SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x000100ff), entry(1, 0x000100ff))); - assertEquals(Arrays.asList(new Hit(1)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(1)).toString(), search.stream().toList().toString()); } @Test @@ -54,7 +54,7 @@ public class PredicateSearchTest { entry(0, 0x00010001)), postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x000200ff))); - assertEquals(Arrays.asList(new Hit(0)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0)).toString(), search.stream().toList().toString()); } @Test @@ -67,7 +67,7 @@ public class PredicateSearchTest { postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(1, 0x000100ff), entry(2, 0x000100ff))); - assertEquals(Arrays.asList(new Hit(1), new Hit(2), new Hit(3)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(1), new Hit(2), new Hit(3)).toString(), search.stream().toList().toString()); } @Test @@ -75,7 +75,7 @@ public class PredicateSearchTest { PredicateSearch search = createPredicateSearch( new byte[0], postingList(SubqueryBitmap.ALL_SUBQUERIES)); - assertEquals(Arrays.asList().toString(), search.stream().toList().toString()); + assertEquals(List.of().toString(), search.stream().toList().toString()); } @Test @@ -87,7 +87,7 @@ public class PredicateSearchTest { entry(1, 0x000100ff)), postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(2, 0x000100ff))); - assertEquals(Arrays.asList(new Hit(0), new Hit(1), new Hit(2)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0), new Hit(1), new Hit(2)).toString(), search.stream().toList().toString()); } @Test @@ -110,7 +110,7 @@ public class PredicateSearchTest { entry(1, 0x000100ff), entry(3, 0x000100ff))); assertEquals( - Arrays.asList(new Hit(0), new Hit(1), new Hit(2), new Hit(3)).toString(), + List.of(new Hit(0), new Hit(1), new Hit(2), new Hit(3)).toString(), search.stream().toList().toString()); } @@ -121,7 +121,7 @@ public class PredicateSearchTest { postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00010001), entry(1, 0x000200ff))); - assertEquals(Arrays.asList().toString(), search.stream().toList().toString()); + assertEquals(List.of().toString(), search.stream().toList().toString()); } @Test @@ -134,7 +134,7 @@ public class PredicateSearchTest { entry(0, 0x000300ff)), postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00020002))); - assertEquals(Arrays.asList(new Hit(0)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0)).toString(), search.stream().toList().toString()); } @Test @@ -143,7 +143,7 @@ public class PredicateSearchTest { new byte[]{1}, postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00010001, 0x00020002, 0x00030003, 0x000100ff, 0x00040004, 0x00050005, 0x00060006))); - assertEquals(Arrays.asList(new Hit(0)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0)).toString(), search.stream().toList().toString()); } @Test @@ -154,7 +154,7 @@ public class PredicateSearchTest { entry(0, 0x00010001)), postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00010000, 0x00ff0001))); - assertEquals(Arrays.asList().toString(), search.stream().toList().toString()); + assertEquals(List.of().toString(), search.stream().toList().toString()); } @Test @@ -163,7 +163,7 @@ public class PredicateSearchTest { new byte[]{1}, postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00010000, 0x00ff0001))); - assertEquals(Arrays.asList(new Hit(0)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0)).toString(), search.stream().toList().toString()); } @Test @@ -172,7 +172,7 @@ public class PredicateSearchTest { new byte[]{1}, postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00020001, 0x00ff0001))); - assertEquals(Arrays.asList().toString(), search.stream().toList().toString()); + assertEquals(List.of().toString(), search.stream().toList().toString()); } @Test @@ -183,7 +183,7 @@ public class PredicateSearchTest { entry(0, 0x00010001)), postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00fe0001, 0x00ff00fe))); - assertEquals(Arrays.asList(new Hit(0)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0)).toString(), search.stream().toList().toString()); } @Test @@ -202,14 +202,14 @@ public class PredicateSearchTest { entry(0, 0x00010008, 0x00060006)), postingList(SubqueryBitmap.ALL_SUBQUERIES, entry(0, 0x00020002, 0x000700ff))); - assertEquals(Arrays.asList(new Hit(0)).toString(), search.stream().toList().toString()); + assertEquals(List.of(new Hit(0)).toString(), search.stream().toList().toString()); } private static PredicateSearch createPredicateSearch(byte[] minFeatures, PostingList... postingLists) { byte[] nPostingListsForDocument = new byte[minFeatures.length]; short[] intervalEnds = new short[minFeatures.length]; Arrays.fill(intervalEnds, (short) 0xFF); - List<PostingList> list = Arrays.asList(postingLists); + List<PostingList> list = List.of(postingLists); for (PostingList postingList : postingLists) { for (int id : postingList.getDocIds()) { nPostingListsForDocument[id]++; diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/ZstarCompressedPostingListTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/ZstarCompressedPostingListTest.java index 408d4f43489..43fd35d8689 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/ZstarCompressedPostingListTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/ZstarCompressedPostingListTest.java @@ -3,7 +3,8 @@ package com.yahoo.search.predicate.index; import org.junit.jupiter.api.Test; -import java.util.Arrays; + +import java.util.List; import static org.junit.jupiter.api.Assertions.*; @@ -14,9 +15,9 @@ public class ZstarCompressedPostingListTest { @Test void requireThatPostingListCanIterate() { PredicateIntervalStore.Builder builder = new PredicateIntervalStore.Builder(); - int ref1 = builder.insert(Arrays.asList(0x10000)); - int ref2 = builder.insert(Arrays.asList(0x10000, 0x0ffff)); - int ref3 = builder.insert(Arrays.asList(0x10000, 0x00003, 0x40003, 0x60005)); + int ref1 = builder.insert(List.of(0x10000)); + int ref2 = builder.insert(List.of(0x10000, 0x0ffff)); + int ref3 = builder.insert(List.of(0x10000, 0x00003, 0x40003, 0x60005)); ZstarCompressedPostingList postingList = new ZstarCompressedPostingList( builder.build(), new int[]{2, 4, 6}, new int[]{ref1, ref2, ref3}); assertEquals(-1, postingList.getDocId()); diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/index/conjunction/ConjunctionIndexTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/index/conjunction/ConjunctionIndexTest.java index 33265d9bb61..c0334b81c59 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/index/conjunction/ConjunctionIndexTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/index/conjunction/ConjunctionIndexTest.java @@ -343,7 +343,7 @@ public class ConjunctionIndexTest { } private static List<ConjunctionHit> matchingConjunctionList(ConjunctionHit... conjunctionHits) { - return Arrays.asList(conjunctionHits); + return List.of(conjunctionHits); } private static void assertHitsEquals(List<ConjunctionHit> hits, IndexableFeatureConjunction... conjunctions) { @@ -356,15 +356,11 @@ public class ConjunctionIndexTest { } private static void assertHitsEquals(List<ConjunctionHit> expectedHits, List<ConjunctionHit> hits) { - Collections.sort(expectedHits); - Collections.sort(hits); - assertArrayEquals( - expectedHits.toArray(new ConjunctionHit[expectedHits.size()]), - hits.toArray(new ConjunctionHit[expectedHits.size()])); + assertEquals(expectedHits.stream().sorted().toList(), hits.stream().sorted().toList()); } private static FeatureConjunction conj(Predicate... operands) { - return new FeatureConjunction(Arrays.asList(operands)); + return new FeatureConjunction(List.of(operands)); } private static IndexableFeatureConjunction indexableConj(FeatureConjunction conjunction) { diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/optimization/FeatureConjunctionTransformerTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/optimization/FeatureConjunctionTransformerTest.java index 2e9c9a32410..c8c4b1f1911 100644 --- a/predicate-search/src/test/java/com/yahoo/search/predicate/optimization/FeatureConjunctionTransformerTest.java +++ b/predicate-search/src/test/java/com/yahoo/search/predicate/optimization/FeatureConjunctionTransformerTest.java @@ -7,7 +7,8 @@ import com.yahoo.document.predicate.FeatureSet; import com.yahoo.document.predicate.Predicate; import org.junit.jupiter.api.Test; -import java.util.Arrays; + +import java.util.List; import static com.yahoo.document.predicate.Predicates.and; import static com.yahoo.document.predicate.Predicates.not; @@ -101,7 +102,7 @@ public class FeatureConjunctionTransformerTest { } private static FeatureConjunction conj(Predicate... operands) { - return new FeatureConjunction(Arrays.asList(operands)); + return new FeatureConjunction(List.of(operands)); } private static FeatureSet featureSet(int id, String... values) { |