Why can I collect a parallel stream to an arbitrarily large array but not a sequential stream?

后端 未结 1 1698
既然无缘
既然无缘 2021-02-13 15:35

From answering this question, I ran into a peculiar feature. The following code works as I assumed it would (the first two values within the existing array would be overridden)

相关标签:
1条回答
  • 2021-02-13 16:29

    The generator function is required to produce "a new array of the desired type and the provided length." If you don't comply with the spec, behavior is undefined.

    0 讨论(0)
提交回复
热议问题