当前位置:网站首页>Collection delete element technique removeif
Collection delete element technique removeif
2022-06-10 23:56:00 【Li_ XiaoJin】
removeIf
removeIf() It's from JDK1.8 Start offering .
see API file :
Delete all elements of this collection that satisfy the given predicate . Errors or runtime exceptions thrown in iterations or predicates are forwarded to the caller .
We deleted List Elements in , Generally, loop traversal is used to realize . Found today removeIf useful , Make a note of .
Previous practice :
List<String> testList = new ArrayList<>();
Iterator<String> it = testList.iterator();
while (it.hasNext()) {
if ("aa".equals(it.next())) {
it.remove();
}
}
Now you can use :
testList.removeIf(s -> "aa".equals(s));
// perhaps
testList.removeIf("aa"::equals);
Copyright: use Creative Commons signature 4.0 International license agreement to license Links:https://lixj.fun/archives/list Delete element technique removeif
边栏推荐
- Interface test learning notes
- 【Pygame合集】滴~穿越童年游戏指南 请查收:这里面有你玩过的游戏嘛?(附五款源码自取)
- [paper sharing] pata: fuzzing with path aware Taint Analysis
- 【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)
- Method of converting file to multipartfile
- Fiddler filtering sessions
- Deepin20菜单启动选项后自检到iwlwifi停机
- VS的常用设置
- [opencv practice] this seal "artifact" is awesome, saving time and improving efficiency. It is powerful ~ (complete source code attached)
- Self made app connected to onenet --- realize data monitoring and distribution control (mqtt)
猜你喜欢

Common settings for vs

SystemVerilog(十)-用户自定义类型

It is said that the verification code is a barrier in the crawler. I can break through it with only five lines of code.

A simple understanding of B tree

Data and information resource sharing platform (6)
![[mathematics] [continuum mechanics] symmetry tensor, strain tensor and stress tensor in fluid mechanics](/img/13/210ed249dfa3010bf69fead8e06f1b.png)
[mathematics] [continuum mechanics] symmetry tensor, strain tensor and stress tensor in fluid mechanics

LabVIEW和VDM提取色彩和生成灰度图像

【 pygame Games 】 don't find, Leisure Games Theme come 丨 Bubble Dragon applet - - Leisure Games Development recommendation

VS的常用设置

HyperLeger Fabric安装
随机推荐
The shell script of pagoda plan task regularly deletes all files under a directory [record]
启牛学堂理财可靠吗,安全吗
Is it safe for changtou school to open an account? Is it reliable?
Flowable process deployment
Create millisecond time id in LabVIEW
LabVIEW锁相环(PLL)
flutter 如何去掉listview顶部空白的问题
怎么生成自动参考文献(简单 有图)
LabVIEW执行串行回送测试
LabVIEW uses the visa read function to read USB interrupt data
IGBT and third generation semiconductor SiC double pulse test scheme
Error report of curl import postman
Top ten information security principles
Im instant messaging source code with tutorial /uniapp instant messaging source code, with installation tutorial
判等问题:如何确定程序的判断是正确的?
黑马头条丨腾讯薪酬制度改革引争议;英特尔全国扩招女工程师;黑马100%就业真的吗......
LabVIEW programming specification
LabVIEW用VISA Read函数来读取USB中断数据
Data and information resource sharing platform (6)
【数学】【连续介质力学】流体力学中的对称张量、应变张量和应力张量