static Slice compactSlice ( Slice slice , int index , int length ) { if ( slice . isCompact ( ) && index == 0 && length == slice . length ( ) ) { return slice ; } return Slices . copyOf ( slice , index , length ) ; }
Returns a slice containing values in the specified range of the specified slice . If the range matches the entire slice the input slice will be returned . Otherwise a copy will be returned .