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

Better document the usage of SimpleMapProperty

XMLWordPrintable

      The usage of SimpleMapProperty should be explained in the JavaDoc. If you only code like this, you don't know, that a "simple" Property won't create a backed Map for storing values.

      If you code this:
      MapProperty<Integer, String> map= new SimpleMapProperty<>();

      you get an error if you try to put some items:
      Exception in thread "main" java.lang.UnsupportedOperationException
          at java.util.AbstractMap.put(AbstractMap.java:203)
          at javafx.beans.binding.MapExpression.put(MapExpression.java:277)

      This is because the default constructor of SimpleMapProperty doesn't create a backed map. Only a call to:

      MapProperty<Integer, String> map= new SimpleMapProperty<>(FXCollections.observableHashMap());

      will produce a valid SimpleMapProperty. But this isn't explained.

            Unassigned Unassigned
            andrejfx André (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: