@DeborahAnn that's something that you have to decide. You should measure both solution and decide whether the memory/computation tradoff is worth it. By the way the words you should be looking for are "caching" and "memoization" which represent two different approaches to this kind of problem. But generally, if the computation is not expensive (for example if those methods are not called in a tight loop) you may just leave it as is and let the jvm optimize it if it needs to.
↧