How does Java: compare objects efficiently?

for example, there is a local class object
remotely calling an api to get the json string of another class object

now to judge whether the two objects are equal or not, we need a lot of comparisons.
is it more efficient to convert local objects to strings than remotely acquired json strings?
or convert the remotely acquired json string into an object
, and this class customizes an equals method for field comparison.
it is more efficient to use the equals method?

Jan.01,2022

convert json to object and then compare
not because of efficiency
but because two json with the same data may have different formats

< hr >

if you don't take these into account, you can only do the tests yourself, because different json libraries show different performance in the face of different objects / json

Menu