晕了.. 半天没人回答呀..  自己顶一下

解决方案 »

  1.   

    从 list 中 取出对象//用来保存 id 和 count ;
    HashMap hm  = new HashMap ();for(Iterator it = list.iterator; it.hasNext();)
    {
          Peoplecomment p = (Peoplecomment )it.next();
         
         int id = p.getId();
       //判断hm 是否有你添加的那个编号id
         if(hm.containsKey(id))
         {
            int count=Integer.parseInt(hm.get(id).toString())  ;
            //存在 评论数 加 1;
            hm.put(id,count++);
            
         }     else{
        //不存在,就是第一个
            hm.put(id,1);
         }
    }经过上面的过程后 ,hm 中就保存了 id 和 count 的一一对应关系。
    然后迭代出 hm  就可以的出你要的结果。
      

  2.   

    上面有的地方名字可能同你的代码里的不相同。
    你自己做一下适当的调整。。
      

  3.   


    顶下,还没有明白你说的意思!