public class CharArrayMap<V>
extends java.util.AbstractMap<java.lang.Object,V>
Modifier and Type | Class and Description |
---|---|
private static class |
CharArrayMap.EmptyCharArrayMap<V>
Empty
CharArrayMap.UnmodifiableCharArrayMap optimized for speed. |
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
|
private class |
CharArrayMap.MapEntry |
(package private) static class |
CharArrayMap.UnmodifiableCharArrayMap<V> |
Modifier and Type | Field and Description |
---|---|
private int |
count |
private static CharArrayMap<?> |
EMPTY_MAP |
private CharArrayMap.EntrySet |
entrySet |
private boolean |
ignoreCase |
private static int |
INIT_SIZE |
(package private) char[][] |
keys |
private CharArraySet |
keySet |
(package private) V[] |
values |
Modifier | Constructor and Description |
---|---|
private |
CharArrayMap(CharArrayMap<V> toCopy)
Create set from the supplied map (used internally for readonly maps...)
|
|
CharArrayMap(int startSize,
boolean ignoreCase)
Create map with enough capacity to hold startSize terms
|
|
CharArrayMap(java.util.Map<?,? extends V> c,
boolean ignoreCase)
Creates a map from the mappings in another map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all entries in this map.
|
boolean |
containsKey(char[] text,
int off,
int len)
|
boolean |
containsKey(java.lang.CharSequence cs)
true if the
CharSequence is in the keySet() |
boolean |
containsKey(java.lang.Object o) |
static <V> CharArrayMap<V> |
copy(java.util.Map<?,? extends V> map)
Returns a copy of the given map as a
CharArrayMap . |
(package private) CharArrayMap.EntrySet |
createEntrySet() |
static <V> CharArrayMap<V> |
emptyMap()
Returns an empty, unmodifiable map.
|
CharArrayMap.EntrySet |
entrySet() |
private boolean |
equals(char[] text1,
int off,
int len,
char[] text2) |
private boolean |
equals(java.lang.CharSequence text1,
char[] text2) |
V |
get(char[] text,
int off,
int len)
returns the value of the mapping of
len chars of text
starting at off |
V |
get(java.lang.CharSequence cs)
returns the value of the mapping of the chars inside this
CharSequence |
V |
get(java.lang.Object o) |
private int |
getHashCode(char[] text,
int offset,
int len) |
private int |
getHashCode(java.lang.CharSequence text) |
private int |
getSlot(char[] text,
int off,
int len) |
private int |
getSlot(java.lang.CharSequence text)
Returns true if the String is in the set
|
CharArraySet |
keySet()
Returns an
CharArraySet view on the map's keys. |
(package private) java.util.Set<java.lang.Object> |
originalKeySet() |
V |
put(char[] text,
V value)
Add the given mapping.
|
V |
put(java.lang.CharSequence text,
V value)
Add the given mapping.
|
V |
put(java.lang.Object o,
V value) |
V |
put(java.lang.String text,
V value)
Add the given mapping.
|
private void |
rehash() |
V |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
static <V> CharArrayMap<V> |
unmodifiableMap(CharArrayMap<V> map)
Returns an unmodifiable
CharArrayMap . |
clone, containsValue, equals, hashCode, isEmpty, putAll, values
private static final CharArrayMap<?> EMPTY_MAP
private static final int INIT_SIZE
private boolean ignoreCase
private int count
char[][] keys
V[] values
private CharArrayMap.EntrySet entrySet
private CharArraySet keySet
public CharArrayMap(int startSize, boolean ignoreCase)
startSize
- the initial capacityignoreCase
- false
if and only if the set should be case sensitive
otherwise true
.public CharArrayMap(java.util.Map<?,? extends V> c, boolean ignoreCase)
c
- a map whose mappings to be copiedignoreCase
- false
if and only if the set should be case sensitive
otherwise true
.private CharArrayMap(CharArrayMap<V> toCopy)
public void clear()
Map.remove(java.lang.Object)
.public boolean containsKey(char[] text, int off, int len)
public boolean containsKey(java.lang.CharSequence cs)
CharSequence
is in the keySet()
public boolean containsKey(java.lang.Object o)
public V get(char[] text, int off, int len)
len
chars of text
starting at off
public V get(java.lang.CharSequence cs)
CharSequence
public V get(java.lang.Object o)
private int getSlot(char[] text, int off, int len)
private int getSlot(java.lang.CharSequence text)
public V put(char[] text, V value)
private void rehash()
private boolean equals(char[] text1, int off, int len, char[] text2)
private boolean equals(java.lang.CharSequence text1, char[] text2)
private int getHashCode(char[] text, int offset, int len)
private int getHashCode(java.lang.CharSequence text)
public V remove(java.lang.Object key)
public int size()
public java.lang.String toString()
toString
in class java.util.AbstractMap<java.lang.Object,V>
CharArrayMap.EntrySet createEntrySet()
public final CharArrayMap.EntrySet entrySet()
final java.util.Set<java.lang.Object> originalKeySet()
public final CharArraySet keySet()
CharArraySet
view on the map's keys.
The set will use the same matchVersion
as this map.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
.java.lang.NullPointerException
- if the given map is null
.public static <V> CharArrayMap<V> copy(java.util.Map<?,? extends V> map)
CharArrayMap
. If the given map
is a CharArrayMap
the ignoreCase property will be preserved.map
- a map to copyCharArrayMap
. 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()