Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
operator fun <T, A, B, C> T.getSlice(first: A, last: B, step: C)
operator fun <T, A, B, C, S> T.setSlice(first: A, last: B, step: C, value: S)
and we can use them:
operator fun <T> List<T>.getSlice(first: Int = 0, last: Int = size - 1, step: Int = 1)
list[first:]
list[first:last]
list[first:last:step]
list[:last]
list[:last:step]
list[first: :step]
list[: :step]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.