From 30acd0a192c0aacbc7936873b1065de74ba96168 Mon Sep 17 00:00:00 2001 From: Maria Margaritis Date: Tue, 5 Mar 2024 23:28:09 +0100 Subject: [PATCH] Closes #2521 - Fix code smells Stream.collect(Collectors.toList()) to Stream.toList() --- .../taskana/task/internal/ObjectReferenceHandler.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceHandler.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceHandler.java index 3442fc04f..5b208fabb 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceHandler.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceHandler.java @@ -56,9 +56,7 @@ public class ObjectReferenceHandler { void insertAndDeleteObjectReferencesOnTaskUpdate(TaskImpl newTaskImpl, TaskImpl oldTaskImpl) throws ObjectReferencePersistenceException, InvalidArgumentException { List newObjectReferences = - newTaskImpl.getSecondaryObjectReferences().stream() - .filter(Objects::nonNull) - .collect(Collectors.toList()); + newTaskImpl.getSecondaryObjectReferences().stream().filter(Objects::nonNull).toList(); newTaskImpl.setSecondaryObjectReferences(newObjectReferences); for (ObjectReference objectReference : newObjectReferences) { @@ -81,7 +79,7 @@ public class ObjectReferenceHandler { List newObjectReferences = newTaskImpl.getSecondaryObjectReferences().stream() .filter(not(o -> oldObjectReferencesIds.contains(o.getId()))) - .collect(Collectors.toList()); + .toList(); for (ObjectReference objectReference : newObjectReferences) { insertNewObjectReferenceOnTaskUpdate(newTaskImpl, objectReference); @@ -115,8 +113,7 @@ public class ObjectReferenceHandler { final List newObjectReferences = newTaskImpl.getSecondaryObjectReferences(); List newObjectReferencesIds = new ArrayList<>(); if (newObjectReferences != null && !newObjectReferences.isEmpty()) { - newObjectReferencesIds = - newObjectReferences.stream().map(ObjectReference::getId).collect(Collectors.toList()); + newObjectReferencesIds = newObjectReferences.stream().map(ObjectReference::getId).toList(); } List oldObjectReferences = oldTaskImpl.getSecondaryObjectReferences(); if (oldObjectReferences != null && !oldObjectReferences.isEmpty()) {