Merge pull request #2230 from eugenp/BAEL-965-removing-lambda
BAEL-965 - reverting to anonymous classes
This commit is contained in:
commit
edda728d5e
@ -54,8 +54,10 @@ public class CollectionUtilsGuideTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenListOfCustomers_whenTransformed_thenListOfAddress() {
|
public void givenListOfCustomers_whenTransformed_thenListOfAddress() {
|
||||||
Collection<Address> addressCol = CollectionUtils.collect(list1, customer -> {
|
Collection<Address> addressCol = CollectionUtils.collect(list1, new Transformer<Customer, Address>() {
|
||||||
|
public Address transform(Customer customer) {
|
||||||
return new Address(customer.getLocality(), customer.getCity(), customer.getZip());
|
return new Address(customer.getLocality(), customer.getCity(), customer.getZip());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<Address> addressList = new ArrayList<>(addressCol);
|
List<Address> addressList = new ArrayList<>(addressCol);
|
||||||
@ -66,7 +68,11 @@ public class CollectionUtilsGuideTest {
|
|||||||
@Test
|
@Test
|
||||||
public void givenCustomerList_whenFiltered_thenCorrectSize() {
|
public void givenCustomerList_whenFiltered_thenCorrectSize() {
|
||||||
|
|
||||||
boolean isModified = CollectionUtils.filter(linkedList1, customer -> Arrays.asList("Daniel","Kyle").contains(customer.getName()));
|
boolean isModified = CollectionUtils.filter(linkedList1, new Predicate<Customer>() {
|
||||||
|
public boolean evaluate(Customer customer) {
|
||||||
|
return Arrays.asList("Daniel","Kyle").contains(customer.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//filterInverse does the opposite. It removes the element from the list if the Predicate returns true
|
//filterInverse does the opposite. It removes the element from the list if the Predicate returns true
|
||||||
//select and selectRejected work the same way except that they do not remove elements from the given collection and return a new collection
|
//select and selectRejected work the same way except that they do not remove elements from the given collection and return a new collection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user