W3cubDocs

/Kotlin

slice

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <T> Array<out T>.slice(indices: IntRange): List<T>
fun ByteArray.slice(indices: IntRange): List<Byte>
fun ShortArray.slice(indices: IntRange): List<Short>
fun IntArray.slice(indices: IntRange): List<Int>
fun LongArray.slice(indices: IntRange): List<Long>
fun FloatArray.slice(indices: IntRange): List<Float>
fun DoubleArray.slice(indices: IntRange): List<Double>
fun BooleanArray.slice(indices: IntRange): List<Boolean>
fun CharArray.slice(indices: IntRange): List<Char>
fun <T> List<T>.slice(indices: IntRange): List<T>
@ExperimentalUnsignedTypes fun UIntArray.slice(
    indices: IntRange
): List<UInt>
@ExperimentalUnsignedTypes fun ULongArray.slice(
    indices: IntRange
): List<ULong>
@ExperimentalUnsignedTypes fun UByteArray.slice(
    indices: IntRange
): List<UByte>
@ExperimentalUnsignedTypes fun UShortArray.slice(
    indices: IntRange
): List<UShort>

Returns a list containing elements at indices in the specified indices range.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <T> Array<out T>.slice(indices: Iterable<Int>): List<T>
fun ByteArray.slice(indices: Iterable<Int>): List<Byte>
fun ShortArray.slice(indices: Iterable<Int>): List<Short>
fun IntArray.slice(indices: Iterable<Int>): List<Int>
fun LongArray.slice(indices: Iterable<Int>): List<Long>
fun FloatArray.slice(indices: Iterable<Int>): List<Float>
fun DoubleArray.slice(indices: Iterable<Int>): List<Double>
fun BooleanArray.slice(indices: Iterable<Int>): List<Boolean>
fun CharArray.slice(indices: Iterable<Int>): List<Char>
fun <T> List<T>.slice(indices: Iterable<Int>): List<T>
@ExperimentalUnsignedTypes fun UIntArray.slice(
    indices: Iterable<Int>
): List<UInt>
@ExperimentalUnsignedTypes fun ULongArray.slice(
    indices: Iterable<Int>
): List<ULong>
@ExperimentalUnsignedTypes fun UByteArray.slice(
    indices: Iterable<Int>
): List<UByte>
@ExperimentalUnsignedTypes fun UShortArray.slice(
    indices: Iterable<Int>
): List<UShort>

Returns a list containing elements at specified indices.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/slice.html