/home/oracle/labs/05LambdaBuiltins/examples/SalesTxn05/src/com/example/lambda/A01Predicate.java
 1 package com.example.lambda;
 2 
 3 import java.util.List;
 4 import java.util.function.Predicate;
 5 
 6 /**
 7  *
 8  * @author MikeW
 9  */
10 public class A01Predicate {
11   
12   public static void main(String[] args){ 
13 
14     List<SalesTxn> tList = SalesTxn.createTxnList();
15     
16     Predicate<SalesTxn> massSales = 
17         t -> t.getState().equals(State.MA);
18     
19     System.out.println("\n== Sales - Stream");
20     tList.stream()
21         .filter(massSales)
22         .forEach(t -> t.printSummary());
23     
24     System.out.println("\n== Sales - Method Call");    
25     for(SalesTxn t:tList){
26         if (massSales.test(t)){
27             t.printSummary();
28         }
29     }
30   }
31 }