> removeIf
removeIf() 是从 JDK1.8 开始提供的。

查看 API 文档:
`删除满足给定谓词的此集合的所有元素。 在迭代或谓词中抛出的错误或运行时异常被转发给调用者。 `

之前我们删除 List 中的元素的话,一般使用循环遍历实现。今天发现 removeIf 很好用,记录一下。
以前做法:
```Java
List<String> testList = new ArrayList<>();
Iterator<String> it = testList.iterator();
while (it.hasNext()) {
if ("aa".equals(it.next())) {
it.remove();
}
}
```
现在可以使用:
```Java
testList.removeIf(s -> "aa".equals(s));
// 或者
testList.removeIf("aa"::equals);
```

集合删除元素技巧 removeIf