Return a list with elements in reversed order.
The reversed function returns a new list with the elements of the original list in reverse order. The original collection is not modified.
For in-place reversal of a mutable list, use the reverse() function instead. reversed is available on Iterable and Array types.
The returned list is a new independent list; modifications to it do not affect the original.
val numbers = listOf(1, 2, 3, 4, 5)
println(numbers.reversed()) // [5, 4, 3, 2, 1]
println(numbers) // [1, 2, 3, 4, 5]