unmodifiableObservableMap.entrySet() provides entries in wrong order

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 8u40
    • Affects Version/s: 8u11
    • Component/s: 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}

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

              Created:
              Updated:
              Resolved:
              Imported: