日期:2014-05-19  浏览次数:21147 次

ArrayList 怎么取前5个数
Java code
 [
 {ls_time=2012-04-25 13:43:08, ls_title=谁说这网站不好,引来了100多的ip,驳斥!!, ls_num=[2], ls_name=by: 游侠实况}, 
 {ls_time=2012-04-26 10:58:09, ls_title=农夫    宝石 。。。, ls_num=[0], ls_name=by: YouCle}, 
 {ls_time=2010-12-13 11:54:38, ls_title=你是靠什么找到工作的?, ls_num=[1], ls_name=by: 游侠实况}, 
 {ls_time=2012-04-19 16:10:32, ls_title=百度联盟,谷歌联盟申请居然呗拒绝, ls_num=[0], ls_name=by: YouCle}, 
 {ls_time=2012-04-15 12:44:18, ls_title=腾讯搜吧有BUG出现, ls_num=[1], ls_name=by: YouCle},
  {ls_time=2012-04-15 09:06:41, ls_title=新浪微博认证太难了, ls_num=[1], ls_name=by: 引领未来}, 
  {ls_time=2012-02-17 19:30:16, ls_title=练习第一帖, ls_num=[21], ls_name=by: 游侠实况}, 
  {ls_time=2011-10-22 18:08:04, ls_title=明星微博@我记录, ls_num=[0], ls_name=by: 游侠实况},
   {ls_time=2011-10-09 13:31:12, ls_title=你使用哪款浏览器?, ls_num=[0], ls_name=by: 游侠实况}, 
   {ls_time=2010-12-12 18:35:56, ls_title=成功的最主要因素是哪个?, ls_num=[0], ls_name=by: 游侠实况}
  ]




arraylist 打印结果

我只想取前5个数,,怎么做

最好越简单越好

------解决方案--------------------
list.subList(0,5);