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

Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • None
    • core-libs
    • None
    • b11

      The code in Integer.decode() and Long.decode() might allocate two instances of Integer/Long for the negative values less than -127:

      Integer result;

      result = Integer.valueOf(nm.substring(index), radix);
      result = negative ? Integer.valueOf(-result.intValue()) : result;

      To avoid this we can declare 'result' as int and use parseInt() method. Same for Long.

            stsypanov Sergey Tsypanov
            stsypanov Sergey Tsypanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: