方法里有段代码不执行.

m21686041 2009-06-02 11:09:52

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

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

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;

}

...全文
131 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
luffyke 2009-06-03
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lvsh870228 的回复:]
for(int i =0;i>bidList.size()-1;i++){
是i <bidList.size()-1 吧 ?
[/Quote]
正解!应该是这里出错了吧,楼主粗心了!
daisycool 2009-06-03
  • 打赏
  • 举报
回复
2楼正解。

另外我怀疑你会得到 Concurrency 错误。
zhong19860904 2009-06-03
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lvsh870228 的回复:]
for(int i =0;i>bidList.size()-1;i++){
是i <bidList.size()-1 吧 ?
[/Quote]

呵呵,可能是楼上说的。
lvsh870228 2009-06-03
  • 打赏
  • 举报
回复
for(int i =0;i>bidList.size()-1;i++){
是i<bidList.size()-1 吧 ?
voisky 2009-06-02
  • 打赏
  • 举报
回复
mark

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧