I have a list on which I'd like to apply some transformations, but excluding the first 2 elements. How can I do it the nicest way? Something like this:
list.reversed().take(list.size - 2)...(my transformations)
or
list.excludeFirstN(2)...(my transformations)
Returns a subsequence of this char sequence containing the last n characters from this char sequence, or the entire char sequence if this char sequence is shorter.
Returns the last valid index for the array. Returns the index of the last item in the list or -1 if the list is empty.
} use accepts a function literal and is defined as an extension on an instance of closeable. It will close down the resource, just like the try-with-resources construct, after the function has been completed, whether an exception was raised or not.
Oh, I found the drop() function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With