This is possible with the new mapConcurrent method
public static <T, R> Gatherer<T, ?, R> mapConcurrent(int maxConcurrency,
Function<? super T, ? extends R> mapper)
so you would write something like this
paths.gather(Gatherers.mapConcurrent(100, p -> p))
.filter(Files::isRegularFile)
.filter(p -> p.toString().endsWith(".jpeg") || p.toString().endsWith(".jpg"))
.forEach(this::resizeAndSaveImage);
Source: https://www.theserverside.com/tip/How-to-use-parallel-streams-in-Java-with-virtual-threads