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

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

public class CharArrayMap<V>
extends java.util.AbstractMap<java.lang.String,V>
implements java.util.Map<java.lang.String,V>, java.lang.Cloneable, java.io.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
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
CharArrayMap(int initialCapacity, boolean ignoreCase)
          Create map with enough capacity to hold startSize terms
 
Method Summary
 void clear()
           
 java.lang.Object clone()
           
 boolean containsKey(java.lang.Object s)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<java.lang.String,V>> entrySet()
           
 V get(char[] key)
           
 V get(char[] key, int off, int len)
           
 V get(java.lang.CharSequence key)
           
 V get(java.lang.Object key)
           
 boolean ignoreCase()
           
 boolean isEmpty()
           
 CharArrayMap.EntryIterator iterator()
          Returns an EntryIterator over this Map.
 V put(char[] key, java.lang.Object val)
          Add this key,val pair to the map.
 V put(java.lang.CharSequence key, V val)
           
 V put(java.lang.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(java.lang.CharSequence key)

get

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

containsKey

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

containsValue

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

put

public V put(java.lang.CharSequence key,
             V val)

put

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

put

public V put(char[] key,
             java.lang.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 java.util.Map<java.lang.String,V>
Overrides:
size in class java.util.AbstractMap<java.lang.String,V>

isEmpty

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

clear

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

entrySet

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

iterator

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


clone

public java.lang.Object clone()
Overrides:
clone in class java.util.AbstractMap<java.lang.String,V>


Copyright © 2006-2010 Hibernate. All Rights Reserved.