diff --git a/lucene/core/src/java/org/apache/lucene/search/Scorable.java b/lucene/core/src/java/org/apache/lucene/search/Scorable.java
index 801dcc873d2..075d8be079c 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Scorable.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Scorable.java
@@ -66,7 +66,7 @@ public abstract class Scorable {
}
/**
- * A child Scorer and its relationship to its parent. the meaning of the relationship depends upon
+ * A child Scorer and its relationship to its parent. The meaning of the relationship depends upon
* the parent query.
*
* @lucene.experimental
@@ -80,7 +80,7 @@ public abstract class Scorable {
/**
* Creates a new ChildScorer node with the specified relationship.
*
- *
The relationship can be any be any string that makes sense to the parent Scorer.
+ *
The relationship can be any string that makes sense to the parent Scorer.
*/
public ChildScorable(Scorable child, String relationship) {
this.child = child;
diff --git a/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java b/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
index 2ecb5e08694..02e5bae87ce 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
@@ -91,7 +91,7 @@ public abstract class TopFieldCollector extends TopDocsCollector {
boolean thresholdCheck(int doc) throws IOException {
if (collectedAllCompetitiveHits || reverseMul * comparator.compareBottom(doc) <= 0) {
// since docs are visited in doc Id order, if compare is 0, it means
- // this document is largest than anything else in the queue, and
+ // this document is larger than anything else in the queue, and
// therefore not competitive.
if (searchSortPartOfIndexSort) {
if (hitsThresholdChecker.isThresholdReached()) {
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java b/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
index d92cf3d02cf..da52c049627 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
@@ -276,11 +276,7 @@ public class FacetsConfig {
checkSeen(seenDims, facetField.dim);
}
String indexFieldName = dimConfig.indexFieldName;
- List fields = byField.get(indexFieldName);
- if (fields == null) {
- fields = new ArrayList<>();
- byField.put(indexFieldName, fields);
- }
+ List fields = byField.computeIfAbsent(indexFieldName, k -> new ArrayList<>());
fields.add(facetField);
}
@@ -291,11 +287,8 @@ public class FacetsConfig {
checkSeen(seenDims, facetField.dim);
}
String indexFieldName = dimConfig.indexFieldName;
- List fields = dvByField.get(indexFieldName);
- if (fields == null) {
- fields = new ArrayList<>();
- dvByField.put(indexFieldName, fields);
- }
+ List fields =
+ dvByField.computeIfAbsent(indexFieldName, k -> new ArrayList<>());
fields.add(facetField);
}
@@ -315,11 +308,8 @@ public class FacetsConfig {
}
String indexFieldName = dimConfig.indexFieldName;
- List fields = assocByField.get(indexFieldName);
- if (fields == null) {
- fields = new ArrayList<>();
- assocByField.put(indexFieldName, fields);
- }
+ List fields =
+ assocByField.computeIfAbsent(indexFieldName, k -> new ArrayList<>());
fields.add(facetField);
// Best effort: detect mis-matched types in same
@@ -338,7 +328,7 @@ public class FacetsConfig {
assocDimTypes.put(indexFieldName, type);
} else if (!curType.equals(type)) {
throw new IllegalArgumentException(
- "mixing incompatible types of AssocationFacetField ("
+ "mixing incompatible types of AssociationFacetField ("
+ curType
+ " and "
+ type
@@ -632,6 +622,6 @@ public class FacetsConfig {
}
parts.add(new String(buffer, 0, upto));
assert !lastEscape;
- return parts.toArray(new String[parts.size()]);
+ return parts.toArray(new String[0]);
}
}