Github user brosander commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1669#discussion_r111806379
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/BulletinMerger.java
---
@@ -71,7 +74,12 @@ public int compare(BulletinEntity o1, BulletinEntity o2)
{
}
}
- Collections.sort(bulletinEntities, (BulletinEntity o1,
BulletinEntity o2) -> {
+ final List<BulletinEntity> entities = Lists.newArrayList();
+
+ final Map<String,List<BulletinEntity>> groupingEntities =
bulletinEntities.stream().collect(Collectors.groupingBy(b ->
b.getBulletin().getMessage()));
+ groupingEntities.keySet().stream().forEach(m ->
entities.add(groupingEntities.get(m).get(0)));
--- End diff --
Would streaming values make this operation a little easier?
Something like:
```
groupingEntities.values().stream().map(e ->
e.get(0)).forEach(entities::add);
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---