'Java ParallelStream with Spring Data JPA
I'm trying to use Java's parallel streams to retrieve records form postgres using Spring Data JPA. If I use the non parallel stream method I get the expected number of results returned. If I use the parallel parallelStream method I get one less returned with the same data. I'm unable to show production code but below is an example of what I'm doing.
List<JpaEntityObject> duplicateEntityList =
mapOfNewEntities.entrySet().parallelStream()
.flatMap(key -> getDuplicateRecordsUsingJpa(key.getKey()).stream())
.collect(Collectors.toList());
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
