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<Entry> updatedEntries = entryList.stream()
.map(e->entityManager.update(entry, entry.getId()))
.collect(toList());