Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created July 1, 2020 10:24
Show Gist options
  • Save theboreddev/06a21a2d7445d284c36960b190e648a8 to your computer and use it in GitHub Desktop.
Save theboreddev/06a21a2d7445d284c36960b190e648a8 to your computer and use it in GitHub Desktop.
parallel parallel
package com.theboreddev.parallelism;
import com.theboreddev.Processor;
import java.util.List;
public class ParallelProcessor implements Processor {
@Override
public Integer process(List<Integer> input) {
return input
.parallelStream()
.reduce(Integer::sum)
.orElse(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment