Chinaunix首页 | 论坛 | 博客
  • 博客访问: 704341
  • 博文数量: 147
  • 博客积分: 6010
  • 博客等级: 准将
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-22 10:36
文章分类

全部博文(147)

文章存档

2011年(1)

2010年(1)

2009年(35)

2008年(110)

我的朋友

分类: Java

2008-11-25 21:41:57

迭代器模式:提供一种方法访问一个容器对象中的各个元素,而又不需暴漏该对象内部的实现细节
例子:

public ArrayList selectSomeComputerInfo(String HQLSelect) throws DAOException{

ArrayList allGoodsInfo=new ArrayList();

List selectAllPOResult=null;

try{

..
selectAllPOResult=query.list();

Iterator allPOItem=selectAllPOResult.iterator();

while(allPOItem.hasNext()){

ComputerInfoPO oneComputerInfoPO=(ComputerInfoPO)allPOItem.next();
allGoodsInfo.add(oneComputerInfoPO);

...

}

}

....

}

阅读(612) | 评论(0) | 转发(0) |
0

上一篇:

下一篇:策略模式

给主人留下些什么吧!~~