You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by zh...@apache.org on 2026/03/04 06:33:43 UTC
(lucene) branch branch_10x updated: Simplify Document#removeFields. (#15771)
This is an automated email from the ASF dual-hosted git repository.
zhouhui pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new 01c9fbb9b85 Simplify Document#removeFields. (#15771)
01c9fbb9b85 is described below
commit 01c9fbb9b85373dad76ce430859be87f418d4bf5
Author: zhouhui <vs...@163.com>
AuthorDate: Wed Mar 4 14:25:59 2026 +0800
Simplify Document#removeFields. (#15771)
---
lucene/core/src/java/org/apache/lucene/document/Document.java | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/document/Document.java b/lucene/core/src/java/org/apache/lucene/document/Document.java
index fabe4f30d2b..e9a409f5287 100644
--- a/lucene/core/src/java/org/apache/lucene/document/Document.java
+++ b/lucene/core/src/java/org/apache/lucene/document/Document.java
@@ -93,13 +93,7 @@ public final class Document implements Iterable<IndexableField> {
* of that document has to be added.
*/
public void removeFields(String name) {
- Iterator<IndexableField> it = fields.iterator();
- while (it.hasNext()) {
- IndexableField field = it.next();
- if (field.name().equals(name)) {
- it.remove();
- }
- }
+ fields.removeIf(field -> field.name().equals(name));
}
/**