根据字段模糊匹配ArrayList里的数据
使用正则表达式进行匹配
降筛选后的数据重新放入一个list
List<Object> dataList= new ArrayList<>();//需要匹配的list
List<Object> dataInfo = new ArrayList<>();//匹配后的list
for(Object data:dataList){
Integer depar_id = data.getInt("departmentId");
if(depar_id!=null){
String idStr = ","+depar_id+",";
String departmentIdNew = "";
departmentIdNew = "," + departmentId + ",";
Pattern pattern2 = Pattern.compile(idStr);
Matcher matcher4 = pattern2.matcher(departmentIdNew);
boolean b = matcher4.find();
if (b) {
if(matcher.find()||matcher2.find()||matcher3.find()){
dataInfo.add(data);
}
}
}
}