In Java is there a performance difference between referencing a field through getter versus through a variable?
问题 Is there any differences between doing Field field = something.getSomethingElse().getField(); if (field == 0) { //do something } somelist.add(field); versus if (something.getSomethingElse().getField() == 0) { //do something } somelist.add(something.getSomethingElse().getField()); Do references to the field through getters incur a performance penalty or is it the same as referencing an assigned variable? I understand that the variable is just a reference to the memory space, so the getter