/** * 消除list中重复项 * @param srcList * @return */ public static List<GpsData> dealRepeat(List<GpsData> srcList){ for(int m =0; m<srcList.size(); m++){ String lat1=srcList.get(m).getLat(); String lng1 =srcList.get(m).getLng(); boolean eq = true; while(eq){ int next = m+1; if(next > srcList.size()-1)break; String lat2=srcList.get(next).getLat(); String lng2 =srcList.get(next).getLng(); if( lat1.equals(lat2) && lng1.equals(lng2) ){ srcList.remove(next); }else{ eq= false; } } } return srcList; }
时间: 2024-10-02 20:40:57