Update min and index , if first element of list > next element
if ( j == 0 && j + 1 < size ) { if ( list . get ( j ) > list . get ( j + 1 ) && min > list . get ( j ) ) { min = list . get ( j ) ; index = j ; } } else if ( j == size - 1 && j - 1 >= 0 ) {