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

ArrayList.subList().spliterator() is not late-binding

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 9
    • core-libs

    Description

      The spliterator created by ArrayList.subList() should be late-binding, but it's not. Here's simple test:

      List<Integer> list = new ArrayList<>(Arrays.asList(1,2,3,4)).subList(0, 3);
      Stream<Integer> s = list.stream();
      list.add(5);
      s.findFirst();
      --> Exception in thread "main" java.util.ConcurrentModificationException

      This works correctly if ArrayList is replaced with LinkedList or Vector.

      Attachments

        Activity

          People

            tvaleev Tagir Valeev
            tvaleev Tagir Valeev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: