日期:2014-05-20  浏览次数:20833 次

方法里有段代码不执行.

碰到个小问题啊..这个方法立马有一段代码没有执行,也没编译报错.

控制台也不打印任何语句.大家帮忙瞅瞅?
也许是当局者迷,我是看不出哪儿出问题了..
Java code

public List getNewBids() {
        // TODO Auto-generated method stub
        Bid bid = new Bid();
        List bidList = bidDao.findByExample(bid);
        
        List bidList2 = bidList;
        
        
        //就是这段代码没有执行,
        
        //将出价表中对同一商品的出价进行筛选.
        for(int i =0;i>bidList.size()-1;i++){
            System.out.println("执行......");
            Goods goods1 = ((Bid)bidList.get(i)).getGoods();
            Goods goods2 = ((Bid)bidList.get(i+1)).getGoods();
            System.out.println(goods1.getGoodsName());
            System.out.println(goods2.getGoodsName());
            if(goods1.getGoodsName().equals(goods2.getGoodsName())){
                System.out.println("删除一条..");
                bidList2.remove(i+1);
            }
        }
        
        int max = 0;
        if(bidList2.size()>3){
            max = 3;
        }else{
            max = bidList2.size();
        }
        List newList = new ArrayList();
        System.out.println("长度对比:"+bidList.size()+"  2:::::"+bidList2.size());
        for(int i =0;i<max;i++){
            
            newList.add(bidList2.get(i));
        }
        
        return newList;
        
    }




------解决方案--------------------
for(int i =0;i>bidList.size()-1;i++){
是i<bidList.size()-1 吧 ?