JiafanZhou
版主
发贴: 736
积分: 61
|
于 2008-01-18 18:05
Ok, your main method looks much better than before. At least the garbage collection daemon will not try to collect your first unused instance, which can greatly improve the performance.
"Refactor this method" 是重构代码的意思。
我前面已经指出来了这个方法的问题,每一次被调用的时候都会有两个实例被创建 1) new ArrayList() 2) new MyObject()
为什么不用一个全局变量呢?
当你这个方法被反复调用的时候,你就会看到瓶颈了。
嘉帆
When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
|