在JDK1.8中,Collection以及其子类新加入了removeIf方法,作用是按照一定规则过滤集合中的元素。这里给读者展示removeIf的用法。
比如我去掉 List idList 集合中id 为 null 的:
idList.removeIf(id -> id == nul);
在JDK1.8中,Collection以及其子类新加入了removeIf方法,作用是按照一定规则过滤集合中的元素。这里给读者展示removeIf的用法。
比如我去掉 List idList 集合中id 为 null 的:
idList.removeIf(id -> id == nul);