java.lang.Object | |||
↳ | java.util.AbstractCollection<E> | ||
↳ | java.util.AbstractSet<E> | ||
↳ | org.apache.lucene.analysis.CharArraySet |
A 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.
Please note: This class implements Set
but
does not behave like it should in all cases. The generic type is
Set<Object>
, because you can add any object to it,
that has a string representation. The add methods will use
toString()
and store the result using a char[]
buffer. The same behaviour have the contains()
methods.
The iterator()
returns an Iterator<String>
.
For type safety also stringIterator()
is provided.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CharArraySet.CharArraySetIterator | The Iterator |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
EMPTY_SET |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create set with enough capacity to hold startSize
terms
| |||||||||||
Create set from a Collection of char[] or String
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add this CharSequence into the set
| |||||||||||
Add this char[] directly to the set.
| |||||||||||
Add this String into the set
| |||||||||||
true if the
len chars of text starting at off
are in the set | |||||||||||
true if the
CharSequence is in the set | |||||||||||
Returns a copy of the given set as a
CharArraySet . | |||||||||||
returns an iterator of new allocated Strings, this method violates the Set interface
| |||||||||||
returns an iterator of new allocated Strings
| |||||||||||
Returns an unmodifiable
CharArraySet . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.AbstractSet
| |||||||||||
From class
java.util.AbstractCollection
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Iterable
| |||||||||||
From interface
java.util.Collection
| |||||||||||
From interface
java.util.Set
|
Create set with enough capacity to hold startSize terms
Create set from a Collection of char[] or String
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.
true if the len
chars of text
starting at off
are in the set
Returns a copy of the given set as a CharArraySet
. If the given set
is a CharArraySet
the ignoreCase property will be preserved.
set | a set to copy |
---|
CharArraySet
. If the given set
is a CharArraySet
the ignoreCase property will be
preserved.
returns an iterator of new allocated Strings, this method violates the Set interface
Returns an unmodifiable CharArraySet
. This allows to provide
unmodifiable views of internal sets for "read-only" use.
set | a set for which the unmodifiable set is returned. |
---|
CharArraySet
.NullPointerException | if the given set is null .
|
---|