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

(prefs) Improve the performance of java.util.prefs.AbstractPreferences.isUserNode()

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b03
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      From the java.lang.Boolean(boolean) API:
      "It is rarely appropriate to use this constructor. Unless a new instance is required, the static factory valueOf(boolean) is generally a better choice. It is likely to yield significantly better space and time performance."

      Boolean objects are immutable, but method java.util.prefs.AbstractPreferences.isUserNode() still uses the Constructor rather than the static method.

         public boolean isUserNode() {
              Boolean result = (Boolean)
                AccessController.doPrivileged( new PrivilegedAction() {
                  public Object run() {
                      return new Boolean(root == Preferences.userRoot()); // <--- here
                  }
              });
              return result.booleanValue();
          }

      ###@###.### 2005-03-21 11:46:44 GMT

        Attachments

          Activity

            People

            Assignee:
            sherman Xueming Shen
            Reporter:
            jloefflm Johann Löfflmann (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: