Created
July 1, 2020 10:24
-
-
Save theboreddev/06a21a2d7445d284c36960b190e648a8 to your computer and use it in GitHub Desktop.
parallel
parallel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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