Skip to content

Commit c4af872

Browse files
authored
Merge pull request eugenp#8001 from eugenp/lambda-compareto
Fixed method reference examples in labmda article
2 parents 8a973cf + 26d4229 commit c4af872

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/methodreference/MethodReferenceUnitTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public void referenceToInstanceMethodOfParticularObject() {
3535
public void referenceToInstanceMethodOfArbitratyObjectOfParticularType() {
3636
List<Integer> numbers = Arrays.asList(5, 3, 50, 24, 40, 2, 9, 18);
3737
numbers.stream()
38-
.sorted((a, b) -> Integer.compare(a, b));
38+
.sorted((a, b) -> a.compareTo(b));
3939
numbers.stream()
40-
.sorted(Integer::compare);
40+
.sorted(Integer::compareTo);
4141
}
4242

4343
@Test

0 commit comments

Comments
 (0)