Is it possible to follow the steps below using streams better?
Set<Long> memberIds = new HashSet<>();
marksDistribution.parallelStream().forEach(marksDistribution -> {
memberIds.add(marksDistribution.getStudentId());
memberIds.add(marksDistribution.getTeacherId());
});
instanceDistribution.getStudentId()and instanceDistribution.getTeacherId()- both types Long.
Perhaps such a question will be asked, but I cannot understand it. In simple yes or no. If yes / no, then like a bit to explain. And if possible, discuss the effectiveness.
source
share