Use stream to get size padding

This commit is contained in:
Andre601 2022-05-04 18:36:46 +02:00
parent 0e0e36476a
commit 0be6b721cf

View File

@ -139,14 +139,9 @@ public final class CommandDump extends PlaceholderCommand {
)
.collect(Collectors.toList());
int size = 0;
for (final String name : expansions.stream().map(PlaceholderExpansion::getIdentifier)
.collect(Collectors.toList())) {
if (name.length() > size) {
size = name.length();
}
}
int size = expansions.stream().map(e -> e.getIdentifier().length())
.max(Integer::compareTo)
.orElse(0);
for (final PlaceholderExpansion expansion : expansions) {
builder.append(" ")
@ -198,12 +193,9 @@ public final class CommandDump extends PlaceholderCommand {
.sorted(Comparator.comparing(Plugin::getName))
.collect(Collectors.toList());
for (final String pluginName : plugins.stream().map(Plugin::getName)
.collect(Collectors.toList())) {
if (pluginName.length() > size) {
size = pluginName.length();
}
}
size = plugins.stream().map(pl -> pl.getName().length())
.max(Integer::compareTo)
.orElse(0);
for (final Plugin other : plugins) {
builder.append(" ")