private <A> ArrayList<int[]> buildPartitions(NumberArrayAdapter<?, A> adapter1, A data1, int len, int depth) {
    final int[] idx = new int[len];
    final double[] tmp = new double[len];
    for(int i = 0; i < len; ++i) {
      idx[i] = i;
      tmp[i] = adapter1.getDouble(data1, i);
    }
    // Sort indexes:
    IntegerArrayQuickSort.sort(idx, (x, y) -> Double.compare(tmp[x], tmp[y]));
    Arrays.sort(tmp); // Should yield the same ordering

    ArrayList<int[]> ret = new ArrayList<>(1 << depth);
    divide(idx, tmp, ret, 0, tmp.length, depth);
    return ret;
  }
private < A > ArrayList < int [ ] > buildPartitions ( NumberArrayAdapter < ? , A > adapter1 , A data1 , int len , int depth ) { final int [ ] idx = new int [ len ] ; final double [ ] tmp = new double [ len ] ; for ( int i = 0 ; i < len ; ++ i ) { idx [ i ] = i ; tmp [ i ] = adapter1 . getDouble ( data1 , i ) ; } IntegerArrayQuickSort . sort ( idx , ( x , y ) -> Double . compare ( tmp [ x ] , tmp [ y ] ) ) ; Arrays . sort ( tmp ) ; ArrayList < int [ ] > ret = new ArrayList < > ( 1 << depth ) ; divide ( idx , tmp , ret , 0 , tmp . length , depth ) ; return ret ; }
Partitions an attribute.

@param adapter1 Data adapter
@param data1 Data set
@param len Length of data
@param depth Splitting depth
@return List of sorted objects