Reputation: 3879
What's the Scala idiom for comparing a long literal with a boxed java.lang.Long? I've come up with
myLong == new java.lang.Long(42L)
but it looks dreadful, and I'm hoping there's some cute syntax I'm not aware of.
Upvotes: 0
Views: 428
Reputation: 2401
Scala ==
uses .equals
method internally. So it does boxing-unboxing automatically. As @Frank S. Thomas said the working way is
myLong == 42L
Upvotes: 6