Java Reference
In-Depth Information
Kind of change: removed
Affected range: [1, 1]
Removed size: 2
Removed: [Two_1, Zero_1]
In all but the removeAll() call, the list change event object contains only one discrete change. The reason that
the removeAll() call generates a list change event that contains two discrete changes is that the three elements that
we wish to remove fall in two disjoint ranges in the list.
In the majority of use cases where we care about list change events, you don't necessarily need to distinguish the
kinds of discrete changes. Sometimes you simply want to do something to all added and removed elements. In such a
case, your ListChangeListener method can be as simple as the following.
@Override
public void onChanged(Change<? extends Foo> change) {
while (change.next()) {
for (Foo foo : change.getAddedSubList()) {
// starting up
}
for (Foo foo : change.getRemoved()) {
// cleaning up
}
}
}
Understanding ObservableMap
Although ObservableMap appears equivalent to ObservableList in the JavaFX observable collections framework
hierarchy, it is actually not as sophisticated as ObservableList . Figure 7-2 is a UML diagram showing the
ObservableMap and supporting interfaces.
Figure 7-2. Key interfaces that support the JavaFX observable map
 
Search WWH ::




Custom Search