File tree Expand file tree Collapse file tree
libraries/src/test/java/com/baeldung/commons/collections Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments