From 687464e9823911b502186b61032239f90adf8d5d Mon Sep 17 00:00:00 2001 From: Emanuel Campolo Date: Tue, 18 Jul 2017 13:52:42 -0300 Subject: [PATCH] Simplify comparator implementation See gh-9781 --- .../boot/cli/command/options/OptionHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index 677b8ee7a8..29d1972d15 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -130,8 +130,8 @@ public class OptionHandler { @Override public String format(Map options) { - Comparator comparator = (first, second) -> first.options() - .iterator().next().compareTo(second.options().iterator().next()); + Comparator comparator = Comparator.comparing( + (optionDescriptor) -> optionDescriptor.options().iterator().next()); Set sorted = new TreeSet<>(comparator); sorted.addAll(options.values()); for (OptionDescriptor descriptor : sorted) {