Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:把自己构造的类加入到ArrayList,如何取回结果? [Re:jimmyofth]
JiafanZhou



版主


发贴: 736
积分: 61
于 2008-01-18 18:05 user profilesend a private message to usersend email to JiafanZhousearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
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.

话题树型展开
人气 标题 作者 字数 发贴时间
10444 把自己构造的类加入到ArrayList,如何取回结果? jimmyofth 1654 2008-01-10 16:37
8669 Re:把自己构造的类加入到ArrayList,如何取回结果? jimmyofth 202 2008-01-10 16:45
8578 Re:把自己构造的类加入到ArrayList,如何取回结果? zcjl 459 2008-01-10 17:01
8614 Re:把自己构造的类加入到ArrayList,如何取回结果? jimmyofth 49 2008-01-10 17:20
8380 Re:把自己构造的类加入到ArrayList,如何取回结果? dylyonia 34 2008-01-15 14:39
8197 Re:把自己构造的类加入到ArrayList,如何取回结果? JiafanZhou 1081 2008-01-16 22:27
8421 Re:把自己构造的类加入到ArrayList,如何取回结果? jimmyofth 777 2008-01-18 11:20
8326 Re:把自己构造的类加入到ArrayList,如何取回结果? jimmyofth 602 2008-01-18 12:08
8423 Re:把自己构造的类加入到ArrayList,如何取回结果? JiafanZhou 352 2008-01-18 18:05

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923