Filter的用法:
public static void main(String[] args) { List<String> list = new ArrayList<>(); list.add("杨贺铮"); list.add("杨铮铮"); list.add("王梦杰"); list.add("武龙"); //两次筛选 list.stream() //筛选去代杨字的 .filter(name ->name.startsWith("杨")) //长度为3 .filter(name -> name.length()==3) .forEach(System.out::println); }
参考:https://blog.51cto.com/u_16099188/6336939
标签:进阶,ArrayList,list,filter,add,查找,name From: https://www.cnblogs.com/2008nmj/p/17648174.html