二维数组按照某列排序

private static void sort(int[][] ob, final int[] order) {
    Arrays.sort(ob, (Comparator) (o1, o2) -> {
        int[] one = (int[]) o1;
        int[] two = (int[]) o2;
        for (int k : order) {
            if (one[k] > two[k]) {
                return 1;
            } else if (one[k] < two[k]) {
                return -1;
            }
        }
        return 0;
    });
} 
  

                            
                        
                    
                    
                    

你可能感兴趣的:(java基础)