Simplify comparator implementation

See gh-9781
pull/9855/head
Emanuel Campolo 7 years ago committed by Phillip Webb
parent 2626a3a795
commit 687464e982

@ -130,8 +130,8 @@ public class OptionHandler {
@Override
public String format(Map<String, ? extends OptionDescriptor> options) {
Comparator<OptionDescriptor> comparator = (first, second) -> first.options()
.iterator().next().compareTo(second.options().iterator().next());
Comparator<OptionDescriptor> comparator = Comparator.comparing(
(optionDescriptor) -> optionDescriptor.options().iterator().next());
Set<OptionDescriptor> sorted = new TreeSet<>(comparator);
sorted.addAll(options.values());
for (OptionDescriptor descriptor : sorted) {

Loading…
Cancel
Save