It looks like the standard Stream API has no scanl equivalent. One reason is that scanl is an operation strictly from left to right, which makes it difficult to take advantage of parallel processing (and parallel processing is an important part of the Stream API). However, you can use third-party libraries, for example, my free StreamEx library. It extends the standard Stream API by adding many more useful features, including scanLeft :
List<Integer> list = IntStreamEx.range(10).boxed().scanLeft(Integer::sum); System.out.println(list);
This scanLeft operation scanLeft guaranteed to work even with parallel threads, but it is unlikely that you will get acceleration if you do not have some computational intensive upstream operations that can be parallelized.
source share