Arrays.sort()的用法 排序一

String[] locals=new String[dnats.size()];
    for(int i=0;i     
     String local_port=dnats.get(i).element("local_port").getText();
     locals[i]=local_port;
    }
    
    Arrays.sort(locals);
    
    for(int i=0;i     String lo=locals[i];
     String lo1="";//小
     String lo2="";//大
     if(i==0){
      lo2=locals[i+1];
      if(lo.equals(lo2)){
       return false;
      }
     }
     else if(i==locals.length-1){
      lo1=locals[i-1];
      if(lo.equals(lo1)){
       return false;
      }
     }else{
      lo1=locals[i-1];
      lo2=locals[i+1];
      if(lo.equals(lo1) || lo.equals(lo2)){
       return false;
      }
     }

你可能感兴趣的:(Arrays.sort()的用法 排序一)