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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 18
    • Affects Version/s: None
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: