List.of: reduce array copying during creation

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P4
    • 16
    • Affects Version/s: None
    • Component/s: core-libs
    • None

      The various fixed-arg factory methods mostly call internal varargs constructors, causing array creating and element copying. The resulting array is passed to a constructor that creates another array and copies it (or clones it) again. Consider the List.of(...) methods that call the ListN() constructor. This is quite wasteful.

      A likely solution is for the fixed-arg API methods to call an internal varargs method, which can trust the array because it originated internally.

      See Peter Levart's comments here:

      http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-May/040791.html

            Assignee:
            Stuart Marks
            Reporter:
            Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: