question: @ Override public DataTable sample ( int newSize ) { int rowCount = getRowNumber ( ) ; if ( rowCount <= newSize ) { return this ; } int [ ] sampledSelectedIndices = new int [ rowCount ] ; for ( int i = 0 ; i < rowCount ; ++ i ) { sampledSelectedIndices [ i ] = i ; } Random rng = new Random ( 0 ) ; int swapIdx ; int tmpValue ; for ( int i = 0 ; i < rowCount ; ++ i ) { swapIdx = rng . nextInt ( rowCount ) ; tmpValue = sampledSelectedIndices [ swapIdx ] ; sampledSelectedIndices [ swapIdx ] = sampledSelectedIndices [ i ] ; sampledSelectedIndices [ i ] = tmpValue ; } DataTableView sampledDataTable = new DataTableView ( this ) ; Vector < Integer > sampledSelectedIndicesVector = new Vector < Integer > ( newSize ) ; for ( int i = 0 ; i < newSize ; ++ i ) { sampledSelectedIndicesVector . add ( sampledSelectedIndices [ i ] ) ; } sampledDataTable . setSelectedIndices ( sampledSelectedIndicesVector ) ; return new SortedDataTableView ( sampledDataTable , sortProvider ) ; }
target:  Performs a simple sampling without replacement. If newSize is greater than the size of this DataTableView, this DataTableView is returned. Creates a view onto this SortedDataTableView (i.e. this SortedDataTableView won't get garbage collected as long as the sampled DataTableView is around.)