diff --git a/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java b/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java index 2e4a1f25f9..5aef4c2704 100644 --- a/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java +++ b/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java @@ -51,13 +51,11 @@ public class CollectionUtilsGuideTest { @Test public void givenListOfCustomers_whenTransformed_thenListOfAddress() { - Collection
addressCol = CollectionUtils.collect(list1, new Transformer() { - public Address transform(Customer customer) { - return new Address(customer.getLocality(), customer.getCity(), customer.getZip()); - } + Collection
addressCol = CollectionUtils.collect(list1, customer -> { + return new Address(customer.getLocality(), customer.getCity(), customer.getZip()); }); - List
addressList = new ArrayList
(addressCol); + List
addressList = new ArrayList<>(addressCol); assertTrue(addressList.size() == 3); assertTrue(addressList.get(0).getLocality().equals("locality1")); } @@ -91,7 +89,7 @@ public class CollectionUtilsGuideTest { @Test public void givenNonEmptyList_whenCheckedIsNotEmpty_thenTrue() { - List emptyList = new ArrayList(); + List emptyList = new ArrayList<>(); List nullList = null; //Very handy at times where we want to check if a collection is not null and not empty too.