org.apache.lucene.analysis
Class CharArraySet
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet
-
- org.apache.lucene.analysis.CharArraySet
-
- All Implemented Interfaces:
- java.lang.Iterable, java.util.Collection, java.util.Set
public class CharArraySet extends java.util.AbstractSetA simple class that stores Strings as char[]'s in a hash table. Note that this is not a general purpose class. For example, it cannot remove items from the set, nor does it resize its hash table to be smaller, etc. It is designed to be quick to test if a char[] is in the set without the necessity of converting it to a String first.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classCharArraySet.CharArraySetIteratorThe Iteratorfor this set.
-
Constructor Summary
Constructors Constructor and Description CharArraySet(java.util.Collection c, boolean ignoreCase)Create set from a Collection of char[] or StringCharArraySet(int startSize, boolean ignoreCase)Create set with enough capacity to hold startSize terms
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanadd(char[] text)Add this char[] directly to the set.booleanadd(java.lang.CharSequence text)Add this CharSequence into the setbooleanadd(java.lang.Object o)booleanadd(java.lang.String text)Add this String into the setbooleancontains(char[] text, int off, int len)true if thelenchars oftextstarting atoffare in the setbooleancontains(java.lang.CharSequence cs)true if theCharSequenceis in the setbooleancontains(java.lang.Object o)booleanisEmpty()java.util.Iteratoriterator()intsize()-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, remove, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
CharArraySet
public CharArraySet(int startSize, boolean ignoreCase)Create set with enough capacity to hold startSize terms
-
CharArraySet
public CharArraySet(java.util.Collection c, boolean ignoreCase)Create set from a Collection of char[] or String
-
-
Method Detail
-
contains
public boolean contains(char[] text, int off, int len)true if thelenchars oftextstarting atoffare in the set
-
contains
public boolean contains(java.lang.CharSequence cs)
true if theCharSequenceis in the set
-
add
public boolean add(java.lang.CharSequence text)
Add this CharSequence into the set
-
add
public boolean add(java.lang.String text)
Add this String into the set
-
add
public boolean add(char[] text)
Add this char[] directly to the set. If ignoreCase is true for this Set, the text array will be directly modified. The user should never modify this text array after calling this method.
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection- Specified by:
sizein interfacejava.util.Set- Specified by:
sizein classjava.util.AbstractCollection
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection- Specified by:
isEmptyin interfacejava.util.Set- Overrides:
isEmptyin classjava.util.AbstractCollection
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection- Specified by:
containsin interfacejava.util.Set- Overrides:
containsin classjava.util.AbstractCollection
-
add
public boolean add(java.lang.Object o)
- Specified by:
addin interfacejava.util.Collection- Specified by:
addin interfacejava.util.Set- Overrides:
addin classjava.util.AbstractCollection
-
iterator
public java.util.Iterator iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable- Specified by:
iteratorin interfacejava.util.Collection- Specified by:
iteratorin interfacejava.util.Set- Specified by:
iteratorin classjava.util.AbstractCollection
-
-
DataMelt 3.0 © DataMelt by jWork.ORG