当前位置:网站首页>Lamda gets the current number of cycles, atomicinteger
Lamda gets the current number of cycles, atomicinteger
2022-07-28 05:29:00 【wang0112233】
demand : Get the object data and assign it to the new object , And sort the objects , Because you can change the order on the page , So we need to store subscripts for sorting
Method 1 :
public static void main(String[] args) {
List<NwWorkOrderFinish> list = new ArrayList<>();
list.add(new NwWorkOrderFinish(1, "1", " Zhang San "));
list.add(new NwWorkOrderFinish(2, "1", " Li Si "));
list.add(new NwWorkOrderFinish(3, "1", " Wang Wu "));
Stream.iterate(1, i -> i + 1).limit(list.size()).forEach(index -> {
System.out.println(index);
});
}Method 2 :
Use atomic classes AtomicInteger
public static void main(String[] args) {
List<NwWorkOrderFinish> list = new ArrayList<>();
list.add(new NwWorkOrderFinish(1, false, " Zhang San "));
list.add(new NwWorkOrderFinish(2, false, " Li Si "));
list.add(new NwWorkOrderFinish(3, false, " Wang Wu "));
AtomicInteger atomicInteger = new AtomicInteger(0);
list.stream().forEach(nwWorkOrderFinish -> {
atomicInteger.decrementAndGet();
System.out.println(atomicInteger.get());
});
}边栏推荐
- JMeter related knowledge sorting
- 使用navicat或plsql导出csv格式,超过15位数字后面变成000(E+19)的问题
- Performance test classification
- About MySQL group_ What concat has to say
- Reading sdwebimage source code Notes
- Edge calculation kubeedge+edgemash
- YUV to uiimage
- Oracle创建表、删除表、修改表(添加字段、修改字段、删除字段)语句总结
- C language: realize the simple function of address book through structure
- Internal implementation principle of yymodel
猜你喜欢

ByteBuffer.position 抛出异常 IllegalArgumentException

Redis 之布隆过滤器

The research group passed the thesis defense successfully
![Classes and objects [medium]](/img/0a/955d00d63f06e7e15e946599628edf.png)
Classes and objects [medium]

Google browser cannot open localhost:3000. If you open localhost, you will jump to the test address

使用navicat或plsql导出csv格式,超过15位数字后面变成000(E+19)的问题

Thinking on multi system architecture design

You must configure either the server or JDBC driver (via the ‘serverTimezone)

Personal summary of restful interface use

Test Development - UI testing in automated testing
随机推荐
(dark horse) MySQL beginner advanced notes (blogger lazy dog)
Digital twin solutions inject new momentum into the construction of chemical parks
mysql的日期与时间函数,varchar与date相互转换
oracle查看锁表语句、解锁方法
How should programmers keep warm when winter is coming
repackag failed: Unable to find main class
11. < tag dynamic programming and subsequence, subarray> lt.115. Different subsequences + Lt. 583. Deletion of two strings DBC
repackag failed: Unable to find main class
【计算机三级信息安全】信息安全保障概述
Mysql处理遗留数据样例
多系统架构设计思考
多线程进阶:锁的策略
Response<T>类
ArrayList多线程安全解决办法
The research group passed the thesis defense successfully
Response < t > class
First acquaintance with C language (1)
Interpreting the source code of cfrunloopref
7.<tag-字符串和API的取舍>补充: 剑指 Offer 05. 替换空格
2022 summer practice (PowerDesigner tutorial learning record) (first week)