当前位置:网站首页>Records of long objects and long judgments in the stream of list
Records of long objects and long judgments in the stream of list
2022-07-03 17:38:00 【Yuyang】
stay stream.filter Chinese comparison Long!=long The results of the process are not really filtered out , The specific phenomena are as follows :
long[] a = new long[]{7864, 284, 347, 7732, 8498};
Long bid = 123123l;
List<Long> il = new ArrayList<>();
il.add(1l);
il.add(2l);
il.add(3l);
il.add(123123l);
System.out.println(il.size());
List<Long> r=il.stream().filter(t -> t != bid).collect(Collectors.toList());
System.out.println(r.size());
result
From the result, we can see the code il.stream().filter(t -> t != bid).collect(Collectors.toList()); Medium filtration bid The value of is not in effect
Problem analysis :bid Defined as objects , Object and concrete value cannot be compared normally
terms of settlement : take bid Change it to big.longValue()
doubt ,Long Object direct comparison is OK , stay stream Not in the middle :
Long as = 1234l;
long b = 1234l;
long c = 11234l;
System.out.println(as != b);
System.out.println(as != c);
result
边栏推荐
- Tensorboard quick start (pytoch uses tensorboard)
- PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
- Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
- Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
- Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
- Cross border e-commerce: advantages of foreign trade enterprises in overseas social media marketing
- Great changes! National housing prices fell below the 10000 yuan mark
- ES6类的继承
- How do large consumer enterprises make digital transformation?
- A day's work list of an ordinary programmer
猜你喜欢
TensorBoard快速入门(Pytorch使用TensorBoard)
Tensorboard quick start (pytoch uses tensorboard)
Luogu: p2685 [tjoi2012] Bridge
How do large consumer enterprises make digital transformation?
Type conversion, variable
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
kubernetes资源对象介绍及常用命令(四)
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
Leetcode Valentine's Day Special - looking for a single dog
随机推荐
The third day of writing C language by Yabo people
【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用
Brief introduction to the core functions of automatic penetration testing tool
RDS数据库的监测页面在哪看?
Great changes! National housing prices fell below the 10000 yuan mark
Notes on problems -- watching videos on edge will make the screen green
远程办公工具分享|社区征文
1146_ SiCp learning notes_ exponentiation
PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
List of financial products in 2022
毕业总结
互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
kubernetes资源对象介绍及常用命令(三)
An example of HP array card troubleshooting
Simple configuration of postfix server
Type conversion, variable
RedHat 6.2 configuring ZABBIX
[combinatorics] recursive equation (case where the non-homogeneous part is exponential | example where the non-homogeneous part is exponential)
Luogu: p2685 [tjoi2012] Bridge