Iterator<Entity> iterator = list.iterator();
while (iterator.hasNext()) {
Entity objects = iterator.next();
Integer answer1= Integer.valueOf(objects.getParentCodeNo());
String answer2= objects.getCodeName();
//和查询条件不一样的过滤掉 其中StringUtils.isNotBlank判断String不为空and不为null
if ((this.query1 != null && !query1.equals(answer1))
|| (StringUtils.isNotBlank(this.query2) && !answer2.contains(this.query2))) {
iterator.remove();
}
}
JAVA 查询条件和iterator
最新推荐文章于 2024-05-07 11:35:56 发布