Skip to content

Apache Lucene open-source search software

Caved in.... HashSet all the way around it is

Erik Hatcher7ceae266c5db
diff --git a/src/java/org/apache/lucene/analysis/StopFilter.java b/src/java/org/apache/lucene/analysis/StopFilter.java
index 0acf1cc2e59..729b37a2b02 100644
--- a/src/java/org/apache/lucene/analysis/StopFilter.java
+++ b/src/java/org/apache/lucene/analysis/StopFilter.java
@@ -57,7 +57,6 @@ package org.apache.lucene.analysis;
import java.io.IOException;
import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Set;
/**
* Removes stop words from a token stream.
@@ -65,7 +64,7 @@ import java.util.Set;
public final class StopFilter extends TokenFilter {
- private Set stopWords;
+ private HashSet stopWords;
/**
* Constructs a filter which removes words from the input
@@ -80,7 +79,7 @@ public final class StopFilter extends TokenFilter {
* Constructs a filter which removes words from the input
* TokenStream that are named in the Hashtable.
*
- * @deprecated Use {@link #StopFilter(TokenStream, Set)} StopFilter(TokenStream,Map)} instead
+ * @deprecated Use {@link #StopFilter(TokenStream, HashSet)} StopFilter(TokenStream,Map)} instead
*/
public StopFilter(TokenStream in, Hashtable stopTable) {
super(in);
@@ -91,9 +90,9 @@ public final class StopFilter extends TokenFilter {
* Constructs a filter which removes words from the input
* TokenStream that are named in the Set.
*/
- public StopFilter(TokenStream in, Set stopWords) {
+ public StopFilter(TokenStream in, HashSet stopWords) {
super(in);
- this.stopWords = new HashSet(stopWords);
+ this.stopWords = stopWords;
}
/**
@@ -117,8 +116,8 @@ public final class StopFilter extends TokenFilter {
* This permits this stopWords construction to be cached once when
* an Analyzer is constructed.
*/
- public static final Set makeStopSet(String[] stopWords) {
- Set stopTable = new HashSet(stopWords.length);
+ public static final HashSet makeStopSet(String[] stopWords) {
+ HashSet stopTable = new HashSet(stopWords.length);
for (int i = 0; i < stopWords.length; i++)
stopTable.add(stopWords[i]);
return stopTable;