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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: