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 key
F - 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 hashmap
    java.util.Collection<F> getAndResetAddedElements()
    Get elements previously added to the HashMap, and reset it for future usage
    java.util.Collection<F> getAndResetRemovedElements()
    Get elements previously removed from the HashMap, and reset it for future usage
    F put​(E key, F value)
    Add a couple key/value in the hashmap Save the value in the collection of the attribute previousAdd
    F remove​(java.lang.Object key)
    Remove a key in the hashmap Save the value in the collection of the attribute previousRemove

    Methods 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

      private java.util.Collection<F> previousAdd
    • previousRemove

      private java.util.Collection<F> previousRemove
  • Constructor Details

    • BufferedHashMap

      public BufferedHashMap()
      Constructor
  • Method Details

    • put

      public F put​(E key, F value)
      Add a couple key/value in the hashmap Save the value in the collection of the attribute previousAdd
      Specified by:
      put in interface java.util.Map<E,​F>
      Overrides:
      put in class java.util.HashMap<E,​F>
      Parameters:
      key - a key
      value - a value
      Returns:
      the previous value of the key
    • remove

      public F remove​(java.lang.Object key)
      Remove a key in the hashmap Save the value in the collection of the attribute previousRemove
      Specified by:
      remove in interface java.util.Map<E,​F>
      Overrides:
      remove in class java.util.HashMap<E,​F>
      Parameters:
      key - a key
      Returns:
      the value matching to the key that was removed
    • clear

      public void clear()
      Clear the hashmap
      Specified by:
      clear in interface java.util.Map<E,​F>
      Overrides:
      clear in class java.util.HashMap<E,​F>
    • getAndResetAddedElements

      public java.util.Collection<F> getAndResetAddedElements()
      Get elements previously added to the HashMap, and reset it for future usage
      Returns:
      Collection of added elements
    • getAndResetRemovedElements

      public java.util.Collection<F> getAndResetRemovedElements()
      Get elements previously removed from the HashMap, and reset it for future usage
      Returns:
      Collection of removed elements