|
||||||||||
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
Map like class of Strings to Objects. 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.
Constructor Summary | |
StringMap()
Constructor. |
|
StringMap(boolean ignoreCase)
Constructor. |
|
StringMap(boolean ignoreCase,
int width)
Constructor. |
Method Summary | |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
get(java.lang.String key)
|
java.util.Map.Entry |
getEntry(byte[] key,
int offset,
int length)
Get a map entry by byte array key. |
java.util.Map.Entry |
getEntry(char[] key,
int offset,
int length)
Get a map entry by char array key. |
java.util.Map.Entry |
getEntry(java.lang.String key,
int offset,
int length)
Get a map entry by substring key. |
int |
getWidth()
|
boolean |
isEmpty()
|
boolean |
isIgnoreCase()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
|
void |
readExternal(java.io.ObjectInput in)
|
java.lang.Object |
remove(java.lang.Object key)
|
java.lang.Object |
remove(java.lang.String key)
|
void |
setIgnoreCase(boolean ic)
Set the ignoreCase attribute. |
void |
setWidth(int width)
Set the hash width. |
int |
size()
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.util.AbstractMap |
containsValue, equals, hashCode, keySet, putAll, toString, values |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
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 java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
put
in class java.util.AbstractMap
public java.lang.Object put(java.lang.String key, java.lang.Object value)
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
get
in class java.util.AbstractMap
public java.lang.Object get(java.lang.String key)
public java.util.Map.Entry getEntry(java.lang.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 java.util.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 java.util.Map.Entry getEntry(byte[] key, int offset, int length)
key
- byte array containing the key. A simple ASCII byte
to char mapping is used.offset
- Offset of the key within the array.length
- The length of the key
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
remove
in class java.util.AbstractMap
public java.lang.Object remove(java.lang.String key)
public java.util.Set entrySet()
entrySet
in interface java.util.Map
entrySet
in class java.util.AbstractMap
public int size()
size
in interface java.util.Map
size
in class java.util.AbstractMap
public boolean isEmpty()
isEmpty
in interface java.util.Map
isEmpty
in class java.util.AbstractMap
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
containsKey
in class java.util.AbstractMap
public void clear()
clear
in interface java.util.Map
clear
in class java.util.AbstractMap
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |