public static < T > List < T > slice ( List < T > list , int ... indexes ) { List < T > slice = new ArrayList <> ( indexes . length ) ; for ( int i : indexes ) { slice . add ( list . get ( i ) ) ; } return slice ; }
Get the elements in the list that are at the indexes .