Java Method invocation vs using a variable

前端 未结 14 2515
北海茫月
北海茫月 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条回答
  •  孤街浪徒
    2020-11-27 03:07

    I am in favour of using temp variable if you are sure about getter will return same value throughout the scope. Because if you have a variable having name of length 10 or more getter looks bad in readability aspect.

提交回复
热议问题