Module javafx.base
Package javafx.collections

# Interface ObservableMap<K,V>

Type Parameters:
  `K` - the map key element type
  `V` - the map value element type

All Superinterfaces:
  `Map<K,V>`, `Observable`

All Known Subinterfaces:
  `ObservableMapValue<K,V>`, `WritableMapValue<K,V>`

All Known Implementing Classes:
  `MapBinding`, `MapExpression`, `MapProperty`, `MapPropertyBase`, `ReadOnlyMapProperty`, `ReadOnlyMapPropertyBase`, `ReadOnlyMapWrapper`, `SimpleMapProperty`

public interface ObservableMap<K,V> extends Map<K,V>, Observable
A map that allows observers to track changes when they occur. Implementations can be created using methods in `FXCollections` such as `observableHashMap`, or with a `SimpleMapProperty`.

Since:
  JavaFX 2.0
See Also:
  - `MapChangeListener`
  - `MapChangeListener.Change`

- ## Nested Class Summary

  ## Nested classes/interfaces declared in interface java.util.Map

  `Map.Entry<K,V>`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addListener(MapChangeListener<? super K,? super V> listener)`
  Add a listener to this observable map.
  `void`
  `removeListener(MapChangeListener<? super K,? super V> listener)`
  Tries to removed a listener from this observable map.

  ### Methods declared in interface java.util.Map

  `clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

  ### Methods declared in interface javafx.beans.Observable

  `addListener, removeListener`

- ## Method Details

  - ### addListener

    void addListener(MapChangeListener<? super K,? super V> listener)
    Add a listener to this observable map.
    Parameters:
      `listener` - the listener for listening to the list changes

  - ### removeListener

    void removeListener(MapChangeListener<? super K,? super V> listener)
    Tries to removed a listener from this observable map. If the listener is not attached to this map, nothing happens.
    Parameters:
      `listener` - a listener to remove