I am still in the process of learning Lambda, please excuse me If I am doing something wrong
final Long tempId = 12345L;
List updatedEntries = new L
You don't have to cram multiple operations into one stream/lambda. Consider separating them into 2 statements (using static import of toList()
):
entryList.forEach(e->e.setTempId(tempId));
List updatedEntries = entryList.stream()
.map(e->entityManager.update(entry, entry.getId()))
.collect(toList());