aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2022-12-02 23:09:25 +0100
committerGitHub <noreply@github.com>2022-12-02 23:09:25 +0100
commitafcf1bb71cb7b87a03149d197f724cfc7603ef92 (patch)
treefff1df3e68101edc3d3d3b98b5eb51b7758c209c /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java
parent7f870bf3cb8dd0a3d015a448608ba7291a783932 (diff)
parentfcf664e1a6bb9890bd54ff4f8b78497236152bf2 (diff)
Merge pull request #25096 from vespa-engine/revert-25091-revert-25088-balder/immutablelist-2-listv8.94.46
Revert "Revert "Let list handling catch up with Java 17""
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java
index 7fc8bfd40ab..57aa3516dfc 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariant.java
@@ -1,11 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.yahoo.search.query.profile.types.QueryProfileType;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* A variant of a query profile
@@ -40,7 +42,7 @@ public class QueryProfileVariant implements Cloneable, Comparable<QueryProfileVa
public Map<String, Object> values() {
if (values == null) {
if (frozen)
- return Collections.emptyMap();
+ return Map.of();
else
values = new HashMap<>();
}
@@ -54,7 +56,7 @@ public class QueryProfileVariant implements Cloneable, Comparable<QueryProfileVa
public List<QueryProfile> inherited() {
if (inherited == null) {
if (frozen)
- return Collections.emptyList();
+ return List.of();
else
inherited = new ArrayList<>();
}
@@ -140,9 +142,9 @@ public class QueryProfileVariant implements Cloneable, Comparable<QueryProfileVa
public void freeze() {
if (frozen) return;
if (inherited != null)
- inherited = ImmutableList.copyOf(inherited);
+ inherited = List.copyOf(inherited);
if (values != null)
- values = ImmutableMap.copyOf(values);
+ values = Map.copyOf(values);
frozen=true;
}