Java Method invocation vs using a variable

前端 未结 14 2418
北海茫月
北海茫月 2020-11-27 02:57

Recently I got into a discussion with my Team lead about using temp variables vs calling getter methods. I was of the opinion for a long time that, if I know that I was goin

14条回答
  •  -上瘾入骨i
    2020-11-27 03:07

    I will not sacrifice "Code readability" to some microseconds.
    Perhaps it is true that getter performs better and can save you several microseconds in runtime. But i believe, variables can save you several hours or perhaps days when bug fixing time comes.

    Sorry for the non-technical answer.

提交回复
热议问题