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

HttpHeaders.firstValueAsLong unnecessarily boxes to Long

XMLWordPrintable

    • master
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      System / OS is irrelevant
      Java version: any since 11

      A DESCRIPTION OF THE PROBLEM :
      HttpHeaders.firstValueAsLong uses mapToLong in combination with Long::valueOf, see https://github.com/openjdk/jdk/blob/master/src/java.net.http/share/classes/java/net/http/HttpHeaders.java#L97C9-L97C16. Since mapToLong accepts a ToLongFunction, this unnecessarily boxes to Long just to auto-unbox again. Replacing Long::valueOf with Long::parseLong would give a (small) performance improvement.

            vyazici Volkan Yazici
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: