I have the following code and it behaves non deterministically sometimes. For example I pass 3 events there and the output have only two! Could you explain the reason of such behaviour?
public List<AbstractTransactionResponse> getEventResponse(final List<AbstractEvent> events){
List<AbstractTransactionResponse> abstractTransactionResponses = new ArrayList<>();
events.parallelStream().map(event -> {
abstractTransactionResponses.add(getEventResponse(event));
return null;
}).collect(Collectors.toList());
return abstractTransactionResponses;
}