Merge pull request #8001 from eugenp/lambda-compareto

Fixed method reference examples in labmda article
This commit is contained in:
Eric Martin
2019-10-11 20:31:37 -05:00
committed by GitHub

View File

@@ -35,9 +35,9 @@ public class MethodReferenceUnitTest {
public void referenceToInstanceMethodOfArbitratyObjectOfParticularType() {
List<Integer> numbers = Arrays.asList(5, 3, 50, 24, 40, 2, 9, 18);
numbers.stream()
.sorted((a, b) -> Integer.compare(a, b));
.sorted((a, b) -> a.compareTo(b));
numbers.stream()
.sorted(Integer::compare);
.sorted(Integer::compareTo);
}
@Test