From 27681b876c1194c0e3bb6bc76ed7989c5445ec2b Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 29 Mar 2021 17:47:11 +0200 Subject: [PATCH] code formatting --- .../dhp/schema/oaf/CleaningFunctions.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java index 401d5d444..8da0a35e4 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/CleaningFunctions.java @@ -152,22 +152,23 @@ public class CleaningFunctions { Optional .ofNullable(i.getPid()) .ifPresent(pid -> { - final Set pids = - pid + final Set pids = pid + .stream() + .filter(Objects::nonNull) + .filter(p -> StringUtils.isNotBlank(p.getValue())) + .collect(Collectors.toCollection(HashSet::new)); + + Optional + .ofNullable(i.getAlternateIdentifier()) + .ifPresent(altId -> { + final Set altIds = altId .stream() .filter(Objects::nonNull) .filter(p -> StringUtils.isNotBlank(p.getValue())) .collect(Collectors.toCollection(HashSet::new)); - Optional.ofNullable(i.getAlternateIdentifier()) - .ifPresent(altId -> { - final Set altIds = altId.stream() - .filter(Objects::nonNull) - .filter(p -> StringUtils.isNotBlank(p.getValue())) - .collect(Collectors.toCollection(HashSet::new)); - - i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids))); - }); + i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids))); + }); }); if (Objects.isNull(i.getAccessright()) || StringUtils.isBlank(i.getAccessright().getClassid())) {