2.List常用的语法

1.List集合中取出某一属性的值的集合       

List list = new ArrayList();

List orderNoList=list.stream().map(User::getOrderNo).collect(Collectors.toList());

List idList=list.stream().map(Order::getId()).collect(Collectors.toList());

2.判断list中是否包含某个对象

List AList=new ArrayList<>();

Integer i =0;

bool b =  AList.contains(i);

3.List中追加list

List result =new ArrayList<>();

List selectProductCommentModelList = new ArrayList<>();

result.addAll(selectProductCommentModelList);

4.判断是否有值

list.isEmpty();

你可能感兴趣的:(2.List常用的语法)