Java 8 adds ``++Comparator.comparing++`` to allow the creation of a single-value comparator to be shorthanded into a single call. This cleaner syntax should be preferred. *Note* that this rule is automatically disabled when the project's ``++sonar.java.source++`` is lower than ``++8++``. == Noncompliant Code Example ---- Comparator compartor = (foo1, foo2) -> foo.getName().compareTo(foo2.getName()); // Noncompliant ---- == Compliant Solution ---- Comparator compartor = Comparator.comparing(Foo::getName); ----