Created
September 18, 2021 11:15
-
-
Save GaetanoPiazzolla/8c961fedf515a402af2703f962f77bae to your computer and use it in GitHub Desktop.
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
| import java.util.stream.Stream; | |
| import java.util.stream.Collectors; | |
| import java.util.*; | |
| public List<String> searchStreamParallel() { | |
| return Files.readAllLines(Path.of(pathFile)) | |
| .parallelStream() | |
| .filter(a -> a.contains(SEARCH_TOKEN)) | |
| .collect(Collectors.toList()); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
related to medium article https://gae-piaz.medium.com/search-string-in-file-with-java-as-fast-as-possible-fedafdc7a3ee