分享一段代码,关于List

	@SuppressWarnings("unchecked")
	public List<LogisticsOrderType> getAllLogisticsOrderType() {
		String sql = "from LogisticsOrderType t where t.status='A' and t.warehouseUsed=null";
		return hibernateTemplate.find(sql + " order by t.id asc");
	}

 

 

	List<LogisticsOrderType> olist = logisticsOrdersTypeService.getAllLogisticsOrderType();
		List<LogisticsOrderType> nlist = new ArrayList<LogisticsOrderType>();
		if (olist != null && olist.size() > 0) {
			for (LogisticsOrderType logisticsOrderType : olist) {
				if (logisticsOrderType.getTypeName() != null
						&& (logisticsOrderType.getTypeCode().contains("bjfh01"))||(logisticsOrderType.getTypeCode().contains("bjfh02"))) {
					nlist.add(logisticsOrderType);
				}
			}
		}

 怎么讲感觉写得是有点烦了,大概意思是是获得一个List 再筛选里面的item 再放入一个list中

 

posted @ 2014-03-04 14:36  Kstyjobx!!  阅读(295)  评论(0编辑  收藏  举报