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
If you want to check whether a JsonArray contains a certain JsonObject or other JsonArray you may wrongly assume you can use the contains method. However as sometimes a JsonObject / JsonArray is represented as a Map or List in the internal JsonArray list, contains might return false even though semantically it should return true. Minimal reproducible example:
My assumption would be that the contains function behaves similarly to the contains function of the List interface, where it is documented that it returns true in case:
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).
Which is not the case for the contains function of the JsonArray. So I would suggest this should be either treated as a bug, or the behaviour should be documented in the JavaDoc of the contains function.
The text was updated successfully, but these errors were encountered:
If you want to check whether a
JsonArray
contains a certainJsonObject
or otherJsonArray
you may wrongly assume you can use thecontains
method. However as sometimes aJsonObject
/JsonArray
is represented as aMap
orList
in the internalJsonArray
list,contains
might returnfalse
even though semantically it should returntrue
. Minimal reproducible example:My assumption would be that the
contains
function behaves similarly to thecontains
function of theList
interface, where it is documented that it returnstrue
in case:Which is not the case for the
contains
function of theJsonArray
. So I would suggest this should be either treated as a bug, or the behaviour should be documented in the JavaDoc of thecontains
function.The text was updated successfully, but these errors were encountered: