Class TrackedMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap
-
- org.onemind.commons.java.datastructure.TrackedMap
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map
public class TrackedMap extends java.util.HashMapA map that has it's map values changes tracked. It uses an inner map to keep the unchanged value and itself to track the changes- Version:
- $Id: TrackedMap.java,v 1.2 2004/08/26 12:33:16 thlee Exp $ $Name: $
- Author:
- TiongHiang Lee (thlee@onemindsoft.org)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map_trackedthe track inner map *
-
Constructor Summary
Constructors Constructor Description TrackedMap()TrackedMap(int initialCapacity)TrackedMap(int initialCapacity, float loadFactor)TrackedMap(java.util.Map map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidclearChanges()Clear all the changesbooleancontainsKey(java.lang.Object key)booleancontainsValue(java.lang.Object value)java.util.SetentrySet()java.lang.Objectget(java.lang.Object key)java.util.SetgetChangedKeySet()Return the key set of changed valuesbooleanhasChanges()Return whether this map has been changesbooleanisEmpty()java.util.SetkeySet()voidmakeUpToDate()Make this map as up-to-date.java.lang.Objectremove(java.lang.Object key)intsize()java.util.Collectionvalues()-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
hasChanges
public boolean hasChanges()
Return whether this map has been changes- Returns:
- true if it has been changed
-
getChangedKeySet
public java.util.Set getChangedKeySet()
Return the key set of changed values- Returns:
- the key set
-
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
getin interfacejava.util.Map- Overrides:
getin classjava.util.HashMap
-
makeUpToDate
public void makeUpToDate()
Make this map as up-to-date.
-
clearChanges
public void clearChanges()
Clear all the changes
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Map- Overrides:
clearin classjava.util.HashMap
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKeyin interfacejava.util.Map- Overrides:
containsKeyin classjava.util.HashMap
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValuein interfacejava.util.Map- Overrides:
containsValuein classjava.util.HashMap
-
entrySet
public java.util.Set entrySet()
- Specified by:
entrySetin interfacejava.util.Map- Overrides:
entrySetin classjava.util.HashMap
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Map- Overrides:
isEmptyin classjava.util.HashMap
-
keySet
public java.util.Set keySet()
- Specified by:
keySetin interfacejava.util.Map- Overrides:
keySetin classjava.util.HashMap
-
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
removein interfacejava.util.Map- Overrides:
removein classjava.util.HashMap
-
size
public int size()
- Specified by:
sizein interfacejava.util.Map- Overrides:
sizein classjava.util.HashMap
-
values
public java.util.Collection values()
- Specified by:
valuesin interfacejava.util.Map- Overrides:
valuesin classjava.util.HashMap
-
-