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

clarify Spliterator.IMMUTABLE and Arrays.asList specifications

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8
    • core-libs
    • None

      The spliterator underlying a stream constructed from Arrays.asList() should have the IMMUTABLE characteristic, since it cannot be structurally modified after creation.

      From: Paul Sandoz:

      The Arrays.ArrayList spliterator should be:

        @Override
        public Spliterator<E> spliterator() {
            return Spliterators.spliterator(a, Spliterator.ORDERED | Spliterator.IMMUTABLE);
        }

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

              Created:
              Updated: