Class ObservableMapWrapper<K,V>

java.lang.Object
com.sun.javafx.collections.ObservableMapWrapper<K,V>
All Implemented Interfaces:
Map<K,V>, Observable, ObservableMap<K,V>

public class ObservableMapWrapper<K,V> extends Object implements ObservableMap<K,V>
A Map wrapper class that implements observability.
  • Constructor Details

    • ObservableMapWrapper

      public ObservableMapWrapper(Map<K,V> map)
  • Method Details

    • callObservers

      protected void callObservers(MapChangeListener.Change<K,V> change)
    • addListener

      public void addListener(InvalidationListener listener)
      Description copied from interface: Observable
      Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

      Note that the same actual InvalidationListener instance may be safely registered for different Observables.

      The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.

      Specified by:
      addListener in interface Observable
      Parameters:
      listener - The listener to register
      See Also:
    • removeListener

      public void removeListener(InvalidationListener listener)
      Description copied from interface: Observable
      Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

      If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

      Specified by:
      removeListener in interface Observable
      Parameters:
      listener - The listener to remove
      See Also:
    • addListener

      public void addListener(MapChangeListener<? super K,? super V> observer)
      Description copied from interface: ObservableMap
      Add a listener to this observable map.
      Specified by:
      addListener in interface ObservableMap<K,V>
      Parameters:
      observer - the listener for listening to the list changes
    • removeListener

      public void removeListener(MapChangeListener<? super K,? super V> observer)
      Description copied from interface: ObservableMap
      Tries to removed a listener from this observable map. If the listener is not attached to this map, nothing happens.
      Specified by:
      removeListener in interface ObservableMap<K,V>
      Parameters:
      observer - a listener to remove
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
    • putAll

      public void putAll(Map<? extends K,? extends V> m)
      Specified by:
      putAll in interface Map<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • keySet

      public Set<K> keySet()
      Specified by:
      keySet in interface Map<K,V>
    • values

      public Collection<V> values()
      Specified by:
      values in interface Map<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class Object