Per https://github.com/vigna/fastutil/issues/211, the toXWithExpectedSize collector methods will preallocate the full size for every worker thread when used on parallel streams.
This is rather wasteful, as most worker threads will not handle the full contents of the stream.
Actually solving this shortcoming may come in future work, but for now we just warn about it in an @implNote
Per https://github.com/vigna/fastutil/issues/211, the
toXWithExpectedSize
collector methods will preallocate the full size for every worker thread when used on parallel streams. This is rather wasteful, as most worker threads will not handle the full contents of the stream.Actually solving this shortcoming may come in future work, but for now we just warn about it in an
@implNote