I'm doing the following comparison:
atividade.getEscala().getId() == escala.getId()
and it returns false
but if I type atividade.getEscala().getId().intValue() == escala.getId().intValue()
then it returns true
. It also returns true
when I write atividade.getEscala().getId().toString().equals(escala.getId().toString())
I know by debugging that the content of both variables is the same ( (java.lang.Long) 2
in display view ), then why does it returns false when I compare the longs with just ==
?