mardi 1 septembre 2015

Does Shorted if evaluate statement twice?

I have the following code:

int num = (map.get(result.getNumber()) != null ? map.get(result.getNumber()) : 0);

My question is:

Do map.get performed twice (one for the evaluation and one for the placement)?

My goal is to reduce the get statement into single call.

Note: result.getNumber is nullable.

Aucun commentaire:

Enregistrer un commentaire