You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These should not be similar, since the value of c is clearly different. However the value of first.similar(second) will be true because for number fields the logic is
if (valueThisinstanceofNumber && valueOtherinstanceofNumber) {
returnisNumberSimilar((Number)valueThis, (Number)valueOther);
}
if (valueThisinstanceofNumber && valueOtherinstanceofNumber) {
if (!isNumberSimilar((Number)valueThis, (Number)valueOther)) {
returnfalse;
}
}
so a single number field triggering that comparison will end the loop in which all fields are compared.
(Note: For some objects or on some JVMs, the behaviour may be unpredictable since the order in which the entries are called is not guaranteed to always be the same on a set.)
I'm using the following JDK to test this:
$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
The text was updated successfully, but these errors were encountered:
In version 20210307 I have the following two JSONObjects:
These should not be similar, since the value of
c
is clearly different. However the value offirst.similar(second)
will betrue
because for number fields the logic is(JSONObject, line 2095) rather than
so a single number field triggering that comparison will end the loop in which all fields are compared.
(Note: For some objects or on some JVMs, the behaviour may be unpredictable since the order in which the entries are called is not guaranteed to always be the same on a set.)
I'm using the following JDK to test this:
$ java -version openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
The text was updated successfully, but these errors were encountered: