|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap org.mortbay.util.StringMap
public class StringMap
Map implementation Optimized for Strings keys.. This String Map has been optimized for mapping small sets of Strings where the most frequently accessed Strings have been put to the map first. It also has the benefit that it can look up entries by substring or sections of char and byte arrays. This can prevent many String objects from being created just to look up in the map. This map is NOT synchronized.
Nested Class Summary | |
---|---|
private static class |
StringMap.Node
|
private class |
StringMap.NullEntry
|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary | |
---|---|
protected static int |
__HASH_WIDTH
|
protected HashSet |
_entrySet
|
protected boolean |
_ignoreCase
|
protected StringMap.NullEntry |
_nullEntry
|
protected Object |
_nullValue
|
protected StringMap.Node |
_root
|
protected Set |
_umEntrySet
|
protected int |
_width
|
static boolean |
CASE_INSENSTIVE
|
Constructor Summary | |
---|---|
StringMap()
Constructor. |
|
StringMap(boolean ignoreCase)
Constructor. |
|
StringMap(boolean ignoreCase,
int width)
Constructor. |
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(Object key)
|
Set |
entrySet()
|
Object |
get(Object key)
|
Object |
get(String key)
|
Map.Entry |
getBestEntry(byte[] key,
int offset,
int maxLength)
Get a map entry by byte array key, using as much of the passed key as needed for a match. |
Map.Entry |
getEntry(char[] key,
int offset,
int length)
Get a map entry by char array key. |
Map.Entry |
getEntry(String key,
int offset,
int length)
Get a map entry by substring key. |
int |
getWidth()
|
boolean |
isEmpty()
|
boolean |
isIgnoreCase()
|
Object |
put(Object key,
Object value)
|
Object |
put(String key,
Object value)
|
void |
readExternal(ObjectInput in)
|
Object |
remove(Object key)
|
Object |
remove(String key)
|
void |
setIgnoreCase(boolean ic)
Set the ignoreCase attribute. |
void |
setWidth(int width)
Set the hash width. |
int |
size()
|
void |
writeExternal(ObjectOutput out)
|
Methods inherited from class java.util.AbstractMap |
---|
clone, containsValue, equals, hashCode, keySet, putAll, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean CASE_INSENSTIVE
protected static final int __HASH_WIDTH
protected int _width
protected StringMap.Node _root
protected boolean _ignoreCase
protected StringMap.NullEntry _nullEntry
protected Object _nullValue
protected HashSet _entrySet
protected Set _umEntrySet
Constructor Detail |
---|
public StringMap()
public StringMap(boolean ignoreCase)
ignoreCase
- public StringMap(boolean ignoreCase, int width)
ignoreCase
- width
- Width of hash tables, larger values are faster but
use more memory.Method Detail |
---|
public void setIgnoreCase(boolean ic)
ic
- If true, the map is case insensitive for keys.public boolean isIgnoreCase()
public void setWidth(int width)
width
- Width of hash tables, larger values are faster but
use more memory.public int getWidth()
public Object put(Object key, Object value)
put
in interface Map
put
in class AbstractMap
public Object put(String key, Object value)
public Object get(Object key)
get
in interface Map
get
in class AbstractMap
public Object get(String key)
public Map.Entry getEntry(String key, int offset, int length)
key
- String containing the keyoffset
- Offset of the key within the String.length
- The length of the key
public Map.Entry getEntry(char[] key, int offset, int length)
key
- char array containing the keyoffset
- Offset of the key within the array.length
- The length of the key
public Map.Entry getBestEntry(byte[] key, int offset, int maxLength)
key
- char array containing the keyoffset
- Offset of the key within the array.maxLength
- The length of the key
public Object remove(Object key)
remove
in interface Map
remove
in class AbstractMap
public Object remove(String key)
public Set entrySet()
entrySet
in interface Map
entrySet
in class AbstractMap
public int size()
size
in interface Map
size
in class AbstractMap
public boolean isEmpty()
isEmpty
in interface Map
isEmpty
in class AbstractMap
public boolean containsKey(Object key)
containsKey
in interface Map
containsKey
in class AbstractMap
public void clear()
clear
in interface Map
clear
in class AbstractMap
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |