private void ensureSortedByIndex(){
  if (currentSortOrder != SORT_ORDER_BY_INDEX) {
    Collections.sort(samples,INDEX_COMPARATOR);
    currentSortOrder=SORT_ORDER_BY_INDEX;
  }
}

private void ensureSortedByIndex ( ) { if ( currentSortOrder != SORT_ORDER_BY_INDEX ) { Collections . sort ( samples , INDEX_COMPARATOR ) ; currentSortOrder = SORT_ORDER_BY_INDEX ; } }
sort the samples by index , if not already .
