org.apache.solr.util
Class CharArrayMap<V>

java.lang.Object
  extended by java.util.AbstractMap<String,V>
      extended by org.apache.solr.util.CharArrayMap<V>
All Implemented Interfaces:
Serializable, Cloneable, Map<String,V>

public class CharArrayMap<V>
extends AbstractMap<String,V>
implements Map<String,V>, Cloneable, Serializable

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.

See Also:
Serialized Form

Nested Class Summary
 class CharArrayMap.EntryIterator
          public iterator 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(int initialCapacity, boolean ignoreCase)
          Create map with enough capacity to hold startSize terms
 
Method Summary
 void clear()
           
 Object clone()
           
 boolean containsKey(Object s)
           
 boolean containsValue(Object value)
           
 Set<Map.Entry<String,V>> entrySet()
           
 V get(char[] key)
           
 V get(char[] key, int off, int len)
           
 V get(CharSequence key)
           
 V get(Object key)
           
 boolean ignoreCase()
           
 boolean isEmpty()
           
 CharArrayMap.EntryIterator iterator()
          Returns an EntryIterator over this Map.
 V put(char[] key, Object val)
          Add this key,val pair to the map.
 V put(CharSequence key, V val)
           
 V put(String key, V val)
           
 int size()
           
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, keySet, putAll, remove, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, keySet, putAll, remove, values
 

Constructor Detail

CharArrayMap

public CharArrayMap(int initialCapacity,
                    boolean ignoreCase)
Create map with enough capacity to hold startSize terms

Method Detail

ignoreCase

public boolean ignoreCase()

get

public V get(char[] key)

get

public V get(char[] key,
             int off,
             int len)

get

public V get(CharSequence key)

get

public V get(Object key)
Specified by:
get in interface Map<String,V>
Overrides:
get in class AbstractMap<String,V>

containsKey

public boolean containsKey(Object s)
Specified by:
containsKey in interface Map<String,V>
Overrides:
containsKey in class AbstractMap<String,V>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<String,V>
Overrides:
containsValue in class AbstractMap<String,V>

put

public V put(CharSequence key,
             V val)

put

public V put(String key,
             V val)
Specified by:
put in interface Map<String,V>
Overrides:
put in class AbstractMap<String,V>

put

public V put(char[] key,
             Object val)
Add this key,val pair to the map. The char[] key is directly used, no copy is made. If ignoreCase is true for this Map, the key array will be directly modified. The user should never modify the key after calling this method.


size

public int size()
Specified by:
size in interface Map<String,V>
Overrides:
size in class AbstractMap<String,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<String,V>
Overrides:
isEmpty in class AbstractMap<String,V>

clear

public void clear()
Specified by:
clear in interface Map<String,V>
Overrides:
clear in class AbstractMap<String,V>

entrySet

public Set<Map.Entry<String,V>> entrySet()
Specified by:
entrySet in interface Map<String,V>
Specified by:
entrySet in class AbstractMap<String,V>

iterator

public CharArrayMap.EntryIterator iterator()
Returns an EntryIterator over this Map.


clone

public Object clone()
Overrides:
clone in class AbstractMap<String,V>


Copyright © 2009 Apache Software Foundation. All Rights Reserved.