JDK-8148748 : ArrayList.subList().spliterator() is not late-binding
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-02-01
  • Updated: 2016-08-24
  • Resolved: 2016-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b112Fixed
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.