package lbd.fastsell.util;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Java8Demo {
public static void main(String[] args) {
List<Integer> ls = Arrays.asList(7, 5, 15, 20);
List<Integer> ls1 = ls.stream().map(aa -> aa * 2).collect(Collectors.toList());
ls1.forEach(yy-> System.out.println(yy));
}
}
package lbd.fastsell.util;
import lbd.fastsell.model.Info;
import javax.persistence.criteria.CriteriaBuilder;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Java8Demo1 {
public static void main(String[] args) {
List ls= Arrays.asList(10,8,2,7);
List Infos=new ArrayList<>();
ls.forEach(a->{
Info info=new Info();
info.setProductPrice(BigDecimal.valueOf(a));
Infos.add(info);
});
ls.forEach(a->System.out.println(a));
}
}