ecologylab.generic
Class HashMapWriteSynch3<K,I,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
ecologylab.generic.HashMapWriteSynch3<K,I,V>
- Type Parameters:
K - Class of the resulting key.I - Class of the intermediate object, which is used to form keys and values.V - Class of the value.
- All Implemented Interfaces:
- ValueFactory<I,V>, java.io.Serializable, java.lang.Cloneable, java.util.Map<K,V>
public abstract class HashMapWriteSynch3<K,I,V>
- extends java.util.HashMap<K,V>
- implements ValueFactory<I,V>
Hashed data structure with synchronized writes/deletes and unsynchronized reads.
Uses three objects, instead of two. The values and keys are both formed from a third intermediate object.
This enables, for example, using a String as a key, but getting that String from an object of another class,
which is also the value.
- Author:
- andruid, robinson
- See Also:
- Serialized Form
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, size, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
HashMapWriteSynch3
public HashMapWriteSynch3(int arg0,
float arg1)
HashMapWriteSynch3
public HashMapWriteSynch3(int arg0)
HashMapWriteSynch3
public HashMapWriteSynch3()
HashMapWriteSynch3
public HashMapWriteSynch3(java.util.Map<? extends K,? extends V> arg0)
createKey
protected abstract K createKey(I intermediate)
createValue
public abstract V createValue(I intermediate)
- Specified by:
createValue in interface ValueFactory<I,V>
getOrCreateAndPutIfNew
public V getOrCreateAndPutIfNew(I intermediate)
getOrCreateAndPutIfNew
public V getOrCreateAndPutIfNew(I intermediate,
ValueFactory<I,V> factory)
- If there is already an entry, return it.
Otherwise, create an entry with the factory.
- Returns:
- The entry matching key, found or constructed.
remove
public V remove(java.lang.Object key)
- Sycnhronizes remove.
- Specified by:
remove in interface java.util.Map<K,V>- Overrides:
remove in class java.util.HashMap<K,V>
putAll
public void putAll(java.util.Map<? extends K,? extends V> m)
- Sycnhronizes if you add another map to this one.
- Specified by:
putAll in interface java.util.Map<K,V>- Overrides:
putAll in class java.util.HashMap<K,V>