当前位置:网站首页>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

边栏推荐
- A day's work list of an ordinary programmer
- How to purchase Google colab members in China
- 【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用
- Open vsftpd port under iptables firewall
- Svn full backup svnadmin hotcopy
- 远程办公工具分享|社区征文
- Swm32 series Tutorial 4 port mapping and serial port application
- ArrayList analysis 3: delete elements
- AcWing 4489. 最长子序列
- Simple use of unity pen XR grab
猜你喜欢

TensorBoard快速入门(Pytorch使用TensorBoard)

Leetcode Valentine's Day Special - looking for a single dog
![[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th](/img/f1/c96c4a6d34e1ae971f492f4aed5a93.jpg)
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th

Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you

SWM32系列教程4-端口映射及串口应用

Design e-commerce spike

Golang unit test, mock test and benchmark test

IntelliJ 2021.3 short command line when running applications

鸿蒙第三次培训
![[UE4] brush Arctic pack high quality Arctic terrain pack](/img/e7/bc86bd8450b0b2bdec8980a2aa1a10.jpg)
[UE4] brush Arctic pack high quality Arctic terrain pack
随机推荐
Vs2013 has blocked the installer, and ie10 needs to be installed
STM32 realizes 74HC595 control
Y is always discrete and can't understand, how to solve it? Answer: read it several times
[vscode] convert tabs to spaces
Implementation of Tetris in C language
Getting started with deops
Where is the monitoring page of RDS database?
Notes on problems -- watching videos on edge will make the screen green
Simple use of unity pen XR grab
互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
The difference between get and post
SWM32系列教程4-端口映射及串口应用
面试官:值为 nil 为什么不等于 nil ?
c# .net 工具生态
ArrayList分析3 : 删除元素
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
Luogu: p2685 [tjoi2012] Bridge
Website with JS doesn't work in IE9 until the Developer Tools is activated
Rsync remote synchronization
Where is the database account used when running SQL tasks in data warehouse tasks configured