Skip to content

Commit

Permalink
New grouping (#46)
Browse files Browse the repository at this point in the history
* Cleaning and stack friendly fixes

* Cleaning

* New way to group ActionElements
  • Loading branch information
AlexPresso authored Oct 1, 2024
1 parent bbd3d21 commit b5b9332
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public void add(final ActionElement element, final int count) {
@Override
public String getIdentifier() {
return this.stream()
.map(ActionElement::getIdentifier)
.collect(Collectors.groupingBy(ActionElement::getIdentifier, Collectors.counting()))
.entrySet()
.stream()
.map(e -> e.getValue() == 1 ? e.getKey() : String.format("%s*%s", e.getKey(), e.getValue()))
.collect(Collectors.joining(" + "));
}
}

0 comments on commit b5b9332

Please sign in to comment.