lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 01/03: Lucene.Net.Analysis.Phonetic, Lucene.Net.TestFramework: Reduced dependency on Lucene.Net.Support.CollectionExtensions by calling ExceptWith instead of CollectionExtensions.RemoveAll()
Date Sat, 24 Jul 2021 19:04:30 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 0e4795f23e7297b6dc45c77395ef9be6ba6d2170
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Sat Jul 24 15:44:38 2021 +0700

    Lucene.Net.Analysis.Phonetic, Lucene.Net.TestFramework: Reduced dependency on Lucene.Net.Support.CollectionExtensions
by calling ExceptWith instead of CollectionExtensions.RemoveAll()
---
 src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs | 10 +++++-----
 src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs     |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs
index 4b1f945..6b6e360 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs
@@ -445,7 +445,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
             }
 
             IList<string> words = WHITESPACE.Split(input).TrimEnd();
-            IList<string> words2 = new List<string>();
+            ISet<string> words2 = new JCG.HashSet<string>();
 
             // special-case handling of word prefixes based upon the name type
             switch (this.nameType)
@@ -457,14 +457,14 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
                         string lastPart = parts[parts.Length - 1];
                         words2.Add(lastPart);
                     }
-                    words2.RemoveAll(NAME_PREFIXES[this.nameType]);
+                    words2.ExceptWith(NAME_PREFIXES[this.nameType]);
                     break;
                 case NameType.ASHKENAZI:
-                    words2.AddRange(words);
-                    words2.RemoveAll(NAME_PREFIXES[this.nameType]);
+                    words2.UnionWith(words);
+                    words2.ExceptWith(NAME_PREFIXES[this.nameType]);
                     break;
                 case NameType.GENERIC:
-                    words2.AddRange(words);
+                    words2.UnionWith(words);
                     break;
                 default:
                     throw new InvalidOperationException("Unreachable case: " + this.nameType);
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index 51319e7..e091f0d 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -255,7 +255,7 @@ namespace Lucene.Net.Store
                 }
                 else
                 {
-                    unSyncedFiles.RemoveAll(names);
+                    unSyncedFiles.ExceptWith(names);
                 }
             }
         }

Mime
View raw message