/home/oracle/labs/05LambdaBuiltins/examples/SalesTxn05/src/com/example/lambda/A04Supplier.java
 1 package com.example.lambda;
 2 
 3 import java.time.LocalDate;
 4 import java.util.List;
 5 import java.util.function.Supplier;
 6 
 7 /**
 8  *
 9  * @author MikeW
10  */
11 public class A04Supplier {
12   
13   public static void main(String[] args){ 
14 
15     List<SalesTxn> tList = SalesTxn.createTxnList();
16     Supplier<SalesTxn> txnSupplier = 
17         () -> new SalesTxn.Builder()
18             .txnId(101)
19             .salesPerson("John Adams")
20             .buyer(Buyer.getBuyerMap().get("PriceCo"))
21             .product("Widget")
22             .paymentType("Cash")
23             .unitPrice(20)
24             .unitCount(8000)
25             .txnDate(LocalDate.of(2013,11,10))
26             .city("Boston")
27             .state(State.MA)
28             .code("02108")
29             .build();
30     
31     tList.add(txnSupplier.get());
32     System.out.println("\n== TList");
33     tList.stream().forEach(SalesTxn::printSummary);
34   }
35 }