aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-29 17:23:21 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-29 17:23:21 +0200
commit090518630dc1e8cec760ae9d831d562fa02b5388 (patch)
tree01dfa4b1bf3f4ddb95cddb2edbae0ae28e5e432d /config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java
parent656e755c584897d298fcf95bea5376f1fb1c13f5 (diff)
List.sort and pattern variables.
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java
index e2bc9897c85..5184d4ef07a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java
@@ -112,7 +112,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer
private void addFieldChildren(QueryProfilesConfig.Queryprofile.Builder qpB, QueryProfile profile, String namePrefix) {
List<Map.Entry<String, Object>> content = new ArrayList<>(profile.declaredContent().entrySet());
- Collections.sort(content, new MapEntryKeyComparator());
+ content.sort(new MapEntryKeyComparator());
if (profile.getValue() != null) { // Add "prefix with dot removed"=value:
QueryProfilesConfig.Queryprofile.Property.Builder propB = new QueryProfilesConfig.Queryprofile.Property.Builder();
String fullName = namePrefix.substring(0, namePrefix.length() - 1);
@@ -132,7 +132,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer
QueryProfile profile,
String namePrefix) {
List<Map.Entry<String, Object>> content = new ArrayList<>(profile.declaredContent().entrySet());
- Collections.sort(content,new MapEntryKeyComparator());
+ content.sort(new MapEntryKeyComparator());
if (profile.getValue() != null) { // Add "prefix with dot removed"=value:
QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder propB = new QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder();
String fullName = namePrefix.substring(0, namePrefix.length() - 1);
@@ -152,8 +152,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer
private void addField(QueryProfilesConfig.Queryprofile.Builder qpB,
QueryProfile profile, Entry<String, Object> field, String namePrefix) {
String fullName=namePrefix + field.getKey();
- if (field.getValue() instanceof QueryProfile) {
- QueryProfile subProfile=(QueryProfile)field.getValue();
+ if (field.getValue() instanceof QueryProfile subProfile) {
if ( ! subProfile.isExplicit()) { // Implicitly defined profile - add content
addFieldChildren(qpB, subProfile,fullName + ".");
}
@@ -172,8 +171,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer
private void addVariantField(QueryProfilesConfig.Queryprofile.Queryprofilevariant.Builder qpB,
Entry<String, Object> field, Boolean overridable, String namePrefix) {
String fullName = namePrefix + field.getKey();
- if (field.getValue() instanceof QueryProfile) {
- QueryProfile subProfile = (QueryProfile)field.getValue();
+ if (field.getValue() instanceof QueryProfile subProfile) {
if ( ! subProfile.isExplicit()) { // Implicitly defined profile - add content
addVariantFieldChildren(qpB, subProfile,fullName + ".");
}
@@ -203,7 +201,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer
varB.inherit(inherited.getId().stringValue());
List<Map.Entry<String,Object>> content = new ArrayList<>(variant.getValues().entrySet());
- Collections.sort(content, new MapEntryKeyComparator());
+ content.sort(new MapEntryKeyComparator());
for (Map.Entry<String, Object> entry : content) {
addVariantField(varB, entry, variant.getOverriable().get(entry.getKey()), "");
}