I have a list of
BasicDBObject that I fetch from my database. This is basically a JSON document converted into a java Object.
Let's assume that we have a
This JSON document may or may not contain the key
name. If the document doesn't contain the key,
result.get("name") will return
Is there a difference in terms of performance between this :
BasicDBObject result = ... Object name = result.get("name"); String nameString = (name == null ? "." : name.toString());
BasicDBObject result = ... String name = (String) result.get("name"); String nameString = (name == null ? "." : name);
Even if this part of the code is called 100 000+ times within a function, I know this wil never be the bottleneck, I'm just interested in the answer.