diff --git a/core-java-8/.classpath b/core-java-8/.classpath
index 6fb6012081..5efa587d72 100644
--- a/core-java-8/.classpath
+++ b/core-java-8/.classpath
@@ -32,6 +32,5 @@
-
diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml
index 0e317e7a94..8d31bea0db 100644
--- a/core-java-8/pom.xml
+++ b/core-java-8/pom.xml
@@ -1,4 +1,5 @@
-
+
4.0.0
org.baeldung
spring-rest
@@ -34,31 +35,8 @@
3.3.2
-
-
-
-
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson.version}
-
-
-
-
- junit
- junit-dep
- ${junit.version}
- test
-
-
-
- org.hamcrest
- hamcrest-core
- ${org.hamcrest.version}
- test
-
+
org.hamcrest
hamcrest-library
@@ -66,6 +44,13 @@
test
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
org.mockito
mockito-core
@@ -107,23 +92,12 @@
-
- 4.0.0.RELEASE
- 3.2.0.RELEASE
-
-
- 4.3.0.Final
- 5.1.27
-
-
- 2.4.0
-
1.7.5
1.0.11
- 5.1.1.Final
+ 5.1.3.Final
18.0
@@ -131,18 +105,13 @@
1.3
- 4.11
- 1.10.8
-
- 4.3.3
- 4.3.4
-
- 2.3.2
+ 4.12
+ 1.10.19
3.2
2.5
- 2.17
+ 2.18.1
2.7
diff --git a/core-java-8/src/test/java/org/baeldung/java8/Java8SortUnitTest.java b/core-java-8/src/test/java/org/baeldung/java8/Java8SortUnitTest.java
index f6b89dd4c9..28604108f6 100644
--- a/core-java-8/src/test/java/org/baeldung/java8/Java8SortUnitTest.java
+++ b/core-java-8/src/test/java/org/baeldung/java8/Java8SortUnitTest.java
@@ -20,26 +20,32 @@ public class Java8SortUnitTest {
@Test
public final void givenPreLambda_whenSortingEntitiesByName_thenCorrectlySorted() {
final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
+
Collections.sort(humans, new Comparator() {
@Override
public final int compare(final Human h1, final Human h2) {
return h1.getName().compareTo(h2.getName());
}
});
+
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
}
@Test
public final void whenSortingEntitiesByName_thenCorrectlySorted() {
final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
+
Collections.sort(humans, (final Human h1, final Human h2) -> h1.getName().compareTo(h2.getName()));
+
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
}
@Test
public final void givenLambdaShortForm_whenSortingEntitiesByName_thenCorrectlySorted() {
final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
- Collections.sort(humans, (h1, h2) -> h1.getName().compareTo(h2.getName()));
+
+ humans.sort((h1, h2) -> h1.getName().compareTo(h2.getName()));
+
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
}