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

unmodifiableObservableMap.entrySet() provides entries in wrong order

XMLWordPrintable

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

      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}

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

              Created:
              Updated:
              Resolved:
              Imported: