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

Avoid redundant Properties.containsKey call in Cursor.getSystemCustomCursor

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 24
    • None
    • client-libs
    • None
    • b27

      The 'Properties' field 'java.awt.Cursor#systemCustomCursorProperties' contains only non-null values. It means we can use 'get'+null check instead of 'containsKey'+'get' calls in the method 'java.awt.Cursor#getSystemCustomCursor'.

                  if (!systemCustomCursorProperties.containsKey(key)) {
                      if (log.isLoggable(PlatformLogger.Level.FINER)) {
                          log.finer("Cursor.getSystemCustomCursor(" + name + ") returned null");
                      }
                      return null;
                  }
                  final String fileName =
                      systemCustomCursorProperties.getProperty(key);

      It's clearer and a bit faster.

            aturbanov Andrey Turbanov
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: