PIP.Collections.Persistent
Class SHashMap<K,V>
java.lang.Object
PIP.Collections.Persistent.AbstractMap<K,V>
PIP.Collections.Persistent.SHashMap<K,V>
- All Implemented Interfaces:
- java.io.Serializable, java.util.Map<K,V>
public class SHashMap<K,V>
- extends AbstractMap<K,V>
- implements java.io.Serializable
JDO requires classes to be enhanced in order to serialise those objects. However, JDO explicitly recognises the
collection classes so that they can be used as member variables without being enhanced and also so that they map
cleanly to referential structures. However, this mechanism does not allow collections to be persisted in other
circumstances such when they are used as values in a map or collections of collections. In order to persist use
collections a first class persistence capable object I have created a new set of classes prefixed by S that mirror
those contained with the Java.utils package. This has pattern has also been provided directly in other JDO
implementations.
Therefore, this class if an exact replication of the standard Java jdk HashMap class
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
|
Method Summary |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this map. |
V |
put(K key,
V value)
Associates the specified value with the specified key in this map (optional operation). |
| Methods inherited from class PIP.Collections.Persistent.AbstractMap |
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
SHashMap
public SHashMap()
entrySet
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
- Description copied from class:
AbstractMap
- Returns a set view of the mappings contained in this map. Each element in this set is a Map.Entry. The set is
backed by the map, so changes to the map are reflected in the set, and vice-versa. (If the map is modified while
an iteration over the set is in progress, the results of the iteration are undefined.) The set supports element
removal, which removes the corresponding entry from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and clear operations. It does not support
the add or addAll operations.
- Specified by:
entrySet in interface java.util.Map<K,V>- Specified by:
entrySet in class AbstractMap<K,V>
- Returns:
- a set view of the mappings contained in this map.
put
public V put(K key,
V value)
- Description copied from class:
AbstractMap
- Associates the specified value with the specified key in this map (optional operation). If the map previously
contained a mapping for this key, the old value is replaced.
This implementation always throws an UnsupportedOperationException.
- Specified by:
put in interface java.util.Map<K,V>- Overrides:
put in class AbstractMap<K,V>
- Parameters:
key - key with which the specified value is to be associated.value - value to be associated with the specified key.
- Returns:
- previous value associated with specified key, or null if there was no mapping for key. (A
null return can also indicate that the map previously associated null with the
specified key, if the implementation supports null values.)