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

unmodifiableObservableMap.entrySet() provides entries in wrong order

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8u40
    • 8u11
    • javafx
    • None

    Description

      UnmodifiableObservableMap.entrySet() is based on HashSet.
      So when I use the following code the order is wrong:
      {code}
      final ObservableMap<String, Integer> map = FXCollections.observableMap(new TreeMap<>());
      ...
      FXCollections.unmodifiableObservableMap(map).entrySet();
      {code}

      I think it would be good if the implementation of UnmodifiableObservableMap.entrySet() will be changed to:
      {code}
          @Override @ReturnsUnmodifiableCollection
          public Set<Entry<K,V>> entrySet() {
              return Collections.unmodifiableMap(backingMap).entrySet();
          }
      {code}

      Attachments

        Activity

          People

            msladecek Martin Sládeček
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: