Skip to content

Commit 03c7ee9

Browse files
BAEL-965 - CollectionUtil
1 parent 6f198df commit 03c7ee9

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ public void givenTwoSortedLists_whenCollated_thenSorted() {
5151

5252
@Test
5353
public void givenListOfCustomers_whenTransformed_thenListOfAddress() {
54-
Collection<Address> addressCol = CollectionUtils.collect(list1, new Transformer<Customer, Address>() {
55-
public Address transform(Customer customer) {
56-
return new Address(customer.getLocality(), customer.getCity(), customer.getZip());
57-
}
54+
Collection<Address> addressCol = CollectionUtils.collect(list1, customer -> {
55+
return new Address(customer.getLocality(), customer.getCity(), customer.getZip());
5856
});
5957

60-
List<Address> addressList = new ArrayList<Address>(addressCol);
58+
List<Address> addressList = new ArrayList<>(addressCol);
6159
assertTrue(addressList.size() == 3);
6260
assertTrue(addressList.get(0).getLocality().equals("locality1"));
6361
}
@@ -91,7 +89,7 @@ public void givenCustomerList_whenForAllDoSetNameNull_thenNameNull() {
9189

9290
@Test
9391
public void givenNonEmptyList_whenCheckedIsNotEmpty_thenTrue() {
94-
List<Customer> emptyList = new ArrayList<Customer>();
92+
List<Customer> emptyList = new ArrayList<>();
9593
List<Customer> nullList = null;
9694

9795
//Very handy at times where we want to check if a collection is not null and not empty too.

0 commit comments

Comments
 (0)