Closes #2521 - Fix code smells Stream.collect(Collectors.toList()) to Stream.toList()

This commit is contained in:
Maria Margaritis 2024-03-05 23:36:27 +01:00
parent 790558d070
commit 4d73759e97
1 changed files with 4 additions and 3 deletions

View File

@ -41,7 +41,7 @@ public class AttachmentHandler {
InvalidArgumentException,
ClassificationNotFoundException {
List<Attachment> newAttachments =
newTaskImpl.getAttachments().stream().filter(Objects::nonNull).toList();
newTaskImpl.getAttachments().stream().filter(Objects::nonNull).collect(Collectors.toList());
newTaskImpl.setAttachments(newAttachments);
for (Attachment attachment : newAttachments) {
@ -91,7 +91,7 @@ public class AttachmentHandler {
List<Attachment> newAttachments =
newTaskImpl.getAttachments().stream()
.filter(not(a -> oldAttachmentIds.contains(a.getId())))
.toList();
.collect(Collectors.toList());
for (Attachment attachment : newAttachments) {
insertNewAttachmentOnTaskUpdate(newTaskImpl, attachment);
@ -123,7 +123,8 @@ public class AttachmentHandler {
final List<Attachment> newAttachments = newTaskImpl.getAttachments();
List<String> newAttachmentIds = new ArrayList<>();
if (newAttachments != null && !newAttachments.isEmpty()) {
newAttachmentIds = newAttachments.stream().map(Attachment::getId).toList();
newAttachmentIds =
newAttachments.stream().map(Attachment::getId).collect(Collectors.toList());
}
List<Attachment> oldAttachments = oldTaskImpl.getAttachments();
if (oldAttachments != null && !oldAttachments.isEmpty()) {