Package fr.r1r0r0.deltaengine.model
Class BufferedHashMap<E,F>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<E,F>
fr.r1r0r0.deltaengine.model.BufferedHashMap<E,F>
- Type Parameters:
E
- the type of the keyF
- the type of the value
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<E,F>
public class BufferedHashMap<E,F>
extends java.util.HashMap<E,F>
A custom HashMap that save element that was added and remove
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object>
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<F>
previousAdd
private java.util.Collection<F>
previousRemove
-
Constructor Summary
Constructors Constructor Description BufferedHashMap()
Constructor -
Method Summary
Modifier and Type Method Description void
clear()
Clear the hashmapjava.util.Collection<F>
getAndResetAddedElements()
Get elements previously added to the HashMap, and reset it for future usagejava.util.Collection<F>
getAndResetRemovedElements()
Get elements previously removed from the HashMap, and reset it for future usageF
put(E key, F value)
Add a couple key/value in the hashmap Save the value in the collection of the attribute previousAddF
remove(java.lang.Object key)
Remove a key in the hashmap Save the value in the collection of the attribute previousRemoveMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, 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
-
Field Details
-
previousAdd
-
previousRemove
-
-
Constructor Details
-
BufferedHashMap
public BufferedHashMap()Constructor
-
-
Method Details
-
put
Add a couple key/value in the hashmap Save the value in the collection of the attribute previousAdd -
remove
Remove a key in the hashmap Save the value in the collection of the attribute previousRemove -
clear
public void clear()Clear the hashmap -
getAndResetAddedElements
Get elements previously added to the HashMap, and reset it for future usage- Returns:
- Collection of added elements
-
getAndResetRemovedElements
Get elements previously removed from the HashMap, and reset it for future usage- Returns:
- Collection of removed elements
-