aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/types
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/types')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java8
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java12
2 files changed, 7 insertions, 13 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java
index f30a3cc5ae6..8fdbf8b2281 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java
@@ -1,11 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
-import com.google.common.collect.ImmutableList;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.query.profile.QueryProfile;
-import java.util.Arrays;
import java.util.List;
/**
@@ -96,14 +94,14 @@ public class FieldDescription implements Comparable<FieldDescription> {
if (name.isCompound() && ! aliases.isEmpty())
throw new IllegalArgumentException("Aliases are not allowed with compound names");
- this.aliases = ImmutableList.copyOf(aliases);
+ this.aliases = List.copyOf(aliases);
this.mandatory = mandatory;
this.overridable = overridable;
}
private static List<String> toList(String string) {
- if (string == null || string.isEmpty()) return ImmutableList.of();
- return ImmutableList.copyOf(Arrays.asList(string.split(" ")));
+ if (string == null || string.isEmpty()) return List.of();
+ return List.of(string.split(" "));
}
/** Returns the full name of this as a string */
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java
index 02a4199d32e..3da2ad53f9a 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java
@@ -1,12 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.yahoo.component.ComponentId;
import com.yahoo.component.provider.FreezableSimpleComponent;
import com.yahoo.processing.request.CompoundName;
-import com.yahoo.search.query.profile.OverridableQueryProfile;
import com.yahoo.search.query.profile.QueryProfile;
import java.util.ArrayList;
@@ -83,8 +80,7 @@ public class QueryProfileType extends FreezableSimpleComponent {
Map<String, FieldDescription> unfrozenFields = new LinkedHashMap<>();
for (Map.Entry<String, FieldDescription> field : fields.entrySet()) {
FieldDescription unfrozenFieldValue = field.getValue();
- if (field.getValue().getType() instanceof QueryProfileFieldType) {
- QueryProfileFieldType queryProfileFieldType = (QueryProfileFieldType)field.getValue().getType();
+ if (field.getValue().getType() instanceof QueryProfileFieldType queryProfileFieldType) {
if (queryProfileFieldType.getQueryProfileType() != null) {
QueryProfileFieldType unfrozenType =
new QueryProfileFieldType(queryProfileFieldType.getQueryProfileType().unfrozen());
@@ -185,8 +181,8 @@ public class QueryProfileType extends FreezableSimpleComponent {
fields.put(field.getName(), field);
}
}
- fields = ImmutableMap.copyOf(fields);
- inherited = ImmutableList.copyOf(inherited);
+ fields = Collections.unmodifiableMap(fields);
+ inherited = List.copyOf(inherited);
strict = isStrict();
matchAsPath = getMatchAsPath();
super.freeze();
@@ -382,7 +378,7 @@ public class QueryProfileType extends FreezableSimpleComponent {
*/
public Map<String, String> aliases() {
if (isFrozen()) return aliases;
- if (aliases == null) return Collections.emptyMap();
+ if (aliases == null) return Map.of();
return Collections.unmodifiableMap(aliases);
}