Preface:
Long in Java is a reference type, while the long type is a basic data type in Java. So Long can not use "==" comparison, long may
text:
1, compare Long
Long L1 = new Long(10); Long L2 = new Long(10);
Method 1: Compare for equality
L1.equals(L2)
Method 2: Comparison of size
L1.longValue () == L2.longValue
2, relatively long
long L1 = 10; long L2 = 15;
method:
L1 == L2
Reference blog:
java in Long type and long type size comparison - liujiding's blog - CSDN blog
https://blog.csdn.net/liujiding/article/details/78297110