Answer the question
In order to leave comments, you need to log in
Java Stream Api: how to get the number of elements without terminating the stream?
I have a stream:
Files.list(tmpDir)
.filter(this::isCacheFileExpired)
// здесь я хочу заллогировать сколько файлов будет удаленно
.forEach(this::deleteCacheFile);
Answer the question
In order to leave comments, you need to log in
It is impossible, this number will appear only after the end of the stream.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question