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

ObservableList.setAll does not conform to specification

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The documentation of javafx.collections.ObservableList#setAll states that the method returns "true (as specified by Collection.add(E))" which implies that the method returns "true if this collection changed as a result of the call". However, when an ObservableList#setAll is invoked on an empty list with an empty array, the list is not modified, but the method still returns "true" (since it is hardcoded).


      ---------- BEGIN SOURCE ----------
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;

      public class Test {

          public static void main(String[] args) {
              ObservableList<String> list = FXCollections.observableArrayList();
              System.out.println(list.setAll()); // prints "true" even though the list was not modified
          }

      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: