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

Better document the usage of SimpleMapProperty

    XMLWordPrintable

    Details

    • Subcomponent:

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Imported: