net.sf.spif.persistence
Class PersistenceOptimizingHashMap
java.lang.Object
|
+--java.util.AbstractMap
|
+--java.util.HashMap
|
+--net.sf.spif.persistence.PersistenceOptimizingHashMap
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class PersistenceOptimizingHashMap
- extends java.util.HashMap
A hash map which automatically remembers it add and remove history.
This history makes StorePersister able to skip unnecessary db updates,
which speeds things up.
To make your db updates more affective, just use this class for your collections
and make sure that you return iterators through one of the iterator methods
on this class, i.e. Collections.unmodifiableCollection(myLisat).iterator
will not make things any fatser.
TODO: Implement support for all methods. Currently just put, get, remove and iterator
- Version:
- $Id: PersistenceOptimizingHashMap.java,v 1.2 2003/02/05 22:15:48 bratseth Exp $
- Author:
- Jon S Bratseth
- See Also:
- Serialized Form
Method Summary |
java.lang.Object |
get(java.lang.Object key)
|
java.util.Iterator |
iterator()
The value iterator. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
recordChanges(boolean doRecord)
Set to false to make changes which won't cause this class to feel changed
or accessed. |
java.lang.Object |
remove(java.lang.Object key)
|
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, 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 |
PersistenceOptimizingHashMap
public PersistenceOptimizingHashMap()
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put
in interface java.util.Map
- Overrides:
put
in class java.util.HashMap
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get
in interface java.util.Map
- Overrides:
get
in class java.util.HashMap
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
remove
in interface java.util.Map
- Overrides:
remove
in class java.util.HashMap
iterator
public java.util.Iterator iterator()
- The value iterator. TODO: Solve another way
recordChanges
public void recordChanges(boolean doRecord)
- Set to false to make changes which won't cause this class to feel changed
or accessed. This is useful to do changes which we know won't affect persistence,
like sorting
Spif 1.01 (2003-04-03). http://spif.sf.net