Skip to content

Commit b5b9332

Browse files
authored
New grouping (#46)
* Cleaning and stack friendly fixes * Cleaning * New way to group ActionElements
1 parent bbd3d21 commit b5b9332

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/me/alexpresso/zuninja/classes/projection/action/ActionElementList.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ public void add(final ActionElement element, final int count) {
1414
@Override
1515
public String getIdentifier() {
1616
return this.stream()
17-
.map(ActionElement::getIdentifier)
17+
.collect(Collectors.groupingBy(ActionElement::getIdentifier, Collectors.counting()))
18+
.entrySet()
19+
.stream()
20+
.map(e -> e.getValue() == 1 ? e.getKey() : String.format("%s*%s", e.getKey(), e.getValue()))
1821
.collect(Collectors.joining(" + "));
1922
}
2023
}

0 commit comments

Comments
 (0)