Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092534

Difference in Behaviour Between ObservableMap & ObservableList When Tied to a Listener

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 8u20
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      Windows 7.
      Java 8 Build 123.
      NetBeans 8.

    • Subcomponent:

      Description

      When I run a setAll on an ObservableList that has a ListChangeListener attached to it, the listener is only woken up once, after all of the items have been added to the list.

      Running putAll on an ObservableMap with a MapChangeListener does not have the same effect. It will wake the listener for every item being added to it.

        Activity

        Hide
        msladecek Martin Sládeček added a comment -
        Yes, I know about this inconsistency. However, the API is designed in this way and MapChangeListener.Change (&SetChangeListener.Change) are not iterable as ListChangeListener.Change so there's no way how to report multiple changes from Map/Set through such listener. Changing this would be backward-incompatible.

        We made ListChangeListener.Change iterable since the list changes are much more complex then map or set changes (where there is no index movement), but there was no need to do it also for map/set.
        Show
        msladecek Martin Sládeček added a comment - Yes, I know about this inconsistency. However, the API is designed in this way and MapChangeListener.Change (&SetChangeListener.Change) are not iterable as ListChangeListener.Change so there's no way how to report multiple changes from Map/Set through such listener. Changing this would be backward-incompatible. We made ListChangeListener.Change iterable since the list changes are much more complex then map or set changes (where there is no index movement), but there was no need to do it also for map/set.

          People

          • Assignee:
            msladecek Martin Sládeček
            Reporter:
            duke J. Duke (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Imported: