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

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

View File

@ -41,7 +41,7 @@ public class AttachmentHandler {
InvalidArgumentException,
ClassificationNotFoundException {
List<Attachment> newAttachments =
newTaskImpl.getAttachments().stream().filter(Objects::nonNull).collect(Collectors.toList());
newTaskImpl.getAttachments().stream().filter(Objects::nonNull).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())))
.collect(Collectors.toList());
.toList();
for (Attachment attachment : newAttachments) {
insertNewAttachmentOnTaskUpdate(newTaskImpl, attachment);
@ -123,8 +123,7 @@ 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).collect(Collectors.toList());
newAttachmentIds = newAttachments.stream().map(Attachment::getId).toList();
}
List<Attachment> oldAttachments = oldTaskImpl.getAttachments();
if (oldAttachments != null && !oldAttachments.isEmpty()) {