reverse

Common
JVM
JS
Native
1.0
fun <T> Array<T>.reverse()
fun ByteArray.reverse()
fun ShortArray.reverse()
fun IntArray.reverse()
fun LongArray.reverse()
fun FloatArray.reverse()
fun DoubleArray.reverse()
fun BooleanArray.reverse()
fun CharArray.reverse()
@ExperimentalUnsignedTypes fun UIntArray.reverse()
@ExperimentalUnsignedTypes fun ULongArray.reverse()
@ExperimentalUnsignedTypes fun UByteArray.reverse()
@ExperimentalUnsignedTypes fun UShortArray.reverse()

Reverses elements in the array in-place.

Common
JVM
JS
Native
1.4
fun <T> Array<T>.reverse(fromIndex: Int, toIndex: Int)
fun ByteArray.reverse(fromIndex: Int, toIndex: Int)
fun ShortArray.reverse(fromIndex: Int, toIndex: Int)
fun IntArray.reverse(fromIndex: Int, toIndex: Int)
fun LongArray.reverse(fromIndex: Int, toIndex: Int)
fun FloatArray.reverse(fromIndex: Int, toIndex: Int)
fun DoubleArray.reverse(fromIndex: Int, toIndex: Int)
fun BooleanArray.reverse(fromIndex: Int, toIndex: Int)
fun CharArray.reverse(fromIndex: Int, toIndex: Int)
@ExperimentalUnsignedTypes fun UIntArray.reverse(
    fromIndex: Int,
    toIndex: Int)
@ExperimentalUnsignedTypes fun ULongArray.reverse(
    fromIndex: Int,
    toIndex: Int)
@ExperimentalUnsignedTypes fun UByteArray.reverse(
    fromIndex: Int,
    toIndex: Int)
@ExperimentalUnsignedTypes fun UShortArray.reverse(
    fromIndex: Int,
    toIndex: Int)

Reverses elements of the array in the specified range in-place.

Parameters

fromIndex - the start of the range (inclusive) to reverse.

toIndex - the end of the range (exclusive) to reverse.

Exceptions

IndexOutOfBoundsException - if fromIndex is less than zero or toIndex is greater than the size of this array.

IllegalArgumentException - if fromIndex is greater than toIndex.

Common
JVM
JS
Native
1.0
fun <T> MutableList<T>.reverse()

Reverses elements in the list in-place.