|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<Object,V> org.apache.lucene.analysis.CharArrayMap<V>
public class CharArrayMap<V>
A simple class that stores key 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 map, nor does it resize its hash table to be smaller, etc. It is designed to be quick to retrieve items by char[] keys without the necessity of converting to a String first.
You must specify the required Version
compatibility when creating CharArrayMap
:
CharArrayMap
with the behavior before Lucene
3.1 pass a Version
< 3.1 to the constructors.
Nested Class Summary | |
---|---|
class |
CharArrayMap.EntryIterator
public iterator class so efficient methods are exposed to users |
class |
CharArrayMap.EntrySet
public EntrySet class so efficient methods are exposed to users |
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
CharArrayMap(Version matchVersion,
int startSize,
boolean ignoreCase)
Create map with enough capacity to hold startSize terms |
|
CharArrayMap(Version matchVersion,
Map<?,? extends V> c,
boolean ignoreCase)
Creates a map from the mappings in another map. |
Method Summary | ||
---|---|---|
void |
clear()
Clears all entries in this map. |
|
boolean |
containsKey(char[] text,
int off,
int len)
true if the len chars of text starting at off
are in the keySet |
|
boolean |
containsKey(CharSequence cs)
true if the CharSequence is in the keySet |
|
boolean |
containsKey(Object o)
|
|
static
|
copy(Version matchVersion,
Map<?,? extends V> map)
Returns a copy of the given map as a CharArrayMap . |
|
static
|
emptyMap()
Returns an empty, unmodifiable map. |
|
CharArrayMap.EntrySet |
entrySet()
|
|
V |
get(char[] text,
int off,
int len)
returns the value of the mapping of len chars of text
starting at off |
|
V |
get(CharSequence cs)
returns the value of the mapping of the chars inside this CharSequence |
|
V |
get(Object o)
|
|
CharArraySet |
keySet()
Returns an CharArraySet view on the map's keys. |
|
V |
put(char[] text,
V value)
Add the given mapping. |
|
V |
put(CharSequence text,
V value)
Add the given mapping. |
|
V |
put(Object o,
V value)
|
|
V |
put(String text,
V value)
Add the given mapping. |
|
V |
remove(Object key)
|
|
int |
size()
|
|
String |
toString()
|
|
static
|
unmodifiableMap(CharArrayMap<V> map)
Returns an unmodifiable CharArrayMap . |
Methods inherited from class java.util.AbstractMap |
---|
clone, containsValue, equals, hashCode, isEmpty, putAll, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CharArrayMap(Version matchVersion, int startSize, boolean ignoreCase)
matchVersion
- compatibility match version see Version
note above for details.startSize
- the initial capacityignoreCase
- false
if and only if the set should be case sensitive
otherwise true
.public CharArrayMap(Version matchVersion, Map<?,? extends V> c, boolean ignoreCase)
matchVersion
- compatibility match version see Version
note above for details.c
- a map whose mappings to be copiedignoreCase
- false
if and only if the set should be case sensitive
otherwise true
.Method Detail |
---|
public void clear()
Map.remove(java.lang.Object)
.
clear
in interface Map<Object,V>
clear
in class AbstractMap<Object,V>
public boolean containsKey(char[] text, int off, int len)
len
chars of text
starting at off
are in the keySet
public boolean containsKey(CharSequence cs)
CharSequence
is in the keySet
public boolean containsKey(Object o)
containsKey
in interface Map<Object,V>
containsKey
in class AbstractMap<Object,V>
public V get(char[] text, int off, int len)
len
chars of text
starting at off
public V get(CharSequence cs)
CharSequence
public V get(Object o)
get
in interface Map<Object,V>
get
in class AbstractMap<Object,V>
public V put(CharSequence text, V value)
public V put(Object o, V value)
put
in interface Map<Object,V>
put
in class AbstractMap<Object,V>
public V put(String text, V value)
public V put(char[] text, V value)
public V remove(Object key)
remove
in interface Map<Object,V>
remove
in class AbstractMap<Object,V>
public int size()
size
in interface Map<Object,V>
size
in class AbstractMap<Object,V>
public String toString()
toString
in class AbstractMap<Object,V>
public final CharArrayMap.EntrySet entrySet()
entrySet
in interface Map<Object,V>
entrySet
in class AbstractMap<Object,V>
public final CharArraySet keySet()
CharArraySet
view on the map's keys.
The set will use the same matchVersion
as this map.
keySet
in interface Map<Object,V>
keySet
in class AbstractMap<Object,V>
public static <V> CharArrayMap<V> unmodifiableMap(CharArrayMap<V> map)
CharArrayMap
. This allows to provide
unmodifiable views of internal map for "read-only" use.
map
- a map for which the unmodifiable map is returned.
CharArrayMap
.
NullPointerException
- if the given map is null
.public static <V> CharArrayMap<V> copy(Version matchVersion, Map<?,? extends V> map)
CharArrayMap
. If the given map
is a CharArrayMap
the ignoreCase property will be preserved.
Note: If you intend to create a copy of another CharArrayMap
where
the Version
of the source map differs from its copy
CharArrayMap(Version, Map, boolean)
should be used instead.
The copy(Version, Map)
will preserve the Version
of the
source map it is an instance of CharArrayMap
.
matchVersion
- compatibility match version see Version
note above for details. This argument will be ignored if the
given map is a CharArrayMap
.map
- a map to copy
CharArrayMap
. If the given map
is a CharArrayMap
the ignoreCase property as well as the
matchVersion will be of the given map will be preserved.public static <V> CharArrayMap<V> emptyMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |