Top Description Inners Methods
javafx.collections

public Interface MapChangeListener<K, V>

Known Direct Implementers
javafx.collections.WeakMapChangeListener, com.sun.javafx.binding.BidirectionalContentBinding.MapContentBinding, com.sun.javafx.binding.ContentBinding.MapContentBinding
Annotations
@FunctionalInterface
Type Parameters
<K>
the key element type
<V>
the value element type

Interface that receives notifications of changes to an ObservableMap.
Since
JavaFX 2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
MapChangeListener.Change<
key type
K
,
value type
V
>

An elementary change done to an ObservableMap.

Method Summary

Modifier and TypeMethod and Description
public void
onChanged(MapChangeListener.Change<? extends K, ? extends V>
the change that was made
change
)

Called after a change has been made to an ObservableMap.

Method Detail

onChangedback to summary
public void onChanged(MapChangeListener.Change<? extends K, ? extends V> change)

Called after a change has been made to an ObservableMap. This method is called on every elementary change (put/remove) once. This means, complex changes like keySet().removeAll(Collection) or clear() may result in more than one call of onChanged method.

Parameters
change:MapChangeListener.Change<? extends K, ? extends V>

the change that was made

javafx.collections back to summary

public abstract Class MapChangeListener.Change<K, V>

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.javafx.binding.MapExpressionHelper.SimpleChange, com.sun.javafx.collections.MapAdapterChange, com.sun.javafx.collections.ObservableMapWrapper.SimpleChange
Type Parameters
<K>
key type
<V>
value type

An elementary change done to an ObservableMap. Change contains information about a put or remove operation. Note that put operation might remove an element if there was already a value associated with the same key. In this case wasAdded() and wasRemoved() will both return true.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private final ObservableMap<K, V>

Constructor Summary

AccessConstructor and Description
public
Change(ObservableMap<K, V>
the source of the change
map
)

Constructs a change associated with a map.

Method Summary

Modifier and TypeMethod and Description
public abstract K

Returns:

the key that changed
getKey
()

A key associated with the change.

public ObservableMap<K, V>

Returns:

the source map
getMap
()

An observable map that is associated with the change.

public abstract V

Returns:

the value that is now associated with the key
getValueAdded
()

Get the new value of the key.

public abstract V

Returns:

the value previously associated with the key
getValueRemoved
()

Get the old value of the key.

public abstract boolean

Returns:

true if a new value (or key-value) entry was added to the map
wasAdded
()

If this change is a result of add operation.

public abstract boolean

Returns:

true if an old value (or key-value) entry was removed from the map
wasRemoved
()

If this change is a result of removal operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private final ObservableMap<K, V> map

Constructor Detail

Changeback to summary
public Change(ObservableMap<K, V> map)

Constructs a change associated with a map.

Parameters
map:ObservableMap<K, V>

the source of the change

Method Detail

getKeyback to summary
public abstract K getKey()

A key associated with the change. If the change is a remove change, the key no longer exist in a map. Otherwise, the key got set to a new value.

Returns:K

the key that changed

getMapback to summary
public ObservableMap<K, V> getMap()

An observable map that is associated with the change.

Returns:ObservableMap<K, V>

the source map

getValueAddedback to summary
public abstract V getValueAdded()

Get the new value of the key. Return null if this is a removal.

Returns:V

the value that is now associated with the key

getValueRemovedback to summary
public abstract V getValueRemoved()

Get the old value of the key. This is null if and only if the value was added to the key that was not previously in the map.

Returns:V

the value previously associated with the key

wasAddedback to summary
public abstract boolean wasAdded()

If this change is a result of add operation.

Returns:boolean

true if a new value (or key-value) entry was added to the map

wasRemovedback to summary
public abstract boolean wasRemoved()

If this change is a result of removal operation. Note that an element might be removed even as a result of put operation.

Returns:boolean

true if an old value (or key-value) entry was removed from the map