this will be a simple question (or at least i think). I have to compare a Long object to a long primitive.
My code simplified:
long primitiveLong = 285825645621;
Long objectLong = new Long(285825645621);
if(primitiveLong == objectLong.longValue()){
System.out.print("They are equals");
}
I expected that it would have worked, but it didn't, can someone explain me why?
Thanks in advance.
EDIT
Ok, i did a mistake using explicit numbers, i'll put here my code:
long identifier = mMarkers.get(marker);
long currentId = item.getId().longValue();
if (currentId==identifier)
System.out.print("They are equals");
In debug
EDIT 2
It was an IDE (Android Studio) bug in debug mode, i tried on another IDE and it worked well with same code. So thanks to everyone for the answers, but the problem was another, that i couldn't expect.