`

去掉list重复元素,list查询

    博客分类:
  • Java
阅读更多
public static ArrayList<GroupReport> queryTaskRoadCode(String req){
		TaskDao taskDao = DaoFactory.getInstance().getTaskDao();
		Connection conn = DaoFactory.getInstance().getConnection();
		
		ArrayList<GroupReport> taskRoadCodeList = null;
	
		try {
			taskRoadCodeList = taskDao.queryTaskRoadCodeList(conn, req);
			for(int i=0;i<taskRoadCodeList.size()-1;i++){
			    for(int j=taskRoadCodeList.size()-1;j>i;j--){
			      if(taskRoadCodeList.get(j).getRoadCode().equals(taskRoadCodeList.get(i).getRoadCode())){
			    	  taskRoadCodeList.remove(j);
			      } 
			    } 
			  } 
			if(taskRoadCodeList!=null){
				return taskRoadCodeList;
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DaoFactory.getInstance().closeConnection(conn);
		}
		return null;
	}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics