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

边栏推荐
- UE4 official charging resources, with a total price of several thousand
- Svn full backup svnadmin hotcopy
- Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
- Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()
- [combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
- IntelliJ 2021.3 short command line when running applications
- Draw some simple graphics with MFC
- Stm32h7 Hal library SPI DMA transmission has been in busy solution
- Leetcode 108 converts an ordered array into a binary search tree -- recursive method
- When absolutely positioned, the element is horizontally and vertically centered
猜你喜欢

vs2013已阻止安装程序,需安装IE10

Kubernetes resource object introduction and common commands (4)

Test your trained model

【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用

Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)

POM in idea XML graying solution

Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source

TensorBoard快速入门(Pytorch使用TensorBoard)

Leetcode 669 pruning binary search tree -- recursive method and iterative method

How to purchase Google colab members in China
随机推荐
QT adjust win screen brightness and sound size
AcWing 4489. Longest subsequence
Luogu: p2685 [tjoi2012] Bridge
国内如何购买Google Colab会员
Deops入门
Qt调节Win屏幕亮度和声音大小
毕业总结
What is the difference between cloud server and cloud virtual machine
Simple configuration of postfix server
Open vsftpd port under iptables firewall
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
[RT thread] NXP rt10xx device driver framework -- RTC construction and use
1164 Good in C
How to read the source code [debug and observe the source code]
Introduction to SolidWorks gear design software tool geartrax
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
Tensorboard quick start (pytoch uses tensorboard)
Host based intrusion system IDS
Interviewer: why is the value nil not equal to nil?
Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source