dropWhile

inline fun <T> Array<out T>.dropWhile(predicate: (T) -> Boolean): List<T>(source)
inline fun ByteArray.dropWhile(predicate: (Byte) -> Boolean): List<Byte>(source)
inline fun ShortArray.dropWhile(predicate: (Short) -> Boolean): List<Short>(source)
inline fun IntArray.dropWhile(predicate: (Int) -> Boolean): List<Int>(source)
inline fun LongArray.dropWhile(predicate: (Long) -> Boolean): List<Long>(source)
inline fun FloatArray.dropWhile(predicate: (Float) -> Boolean): List<Float>(source)
inline fun DoubleArray.dropWhile(predicate: (Double) -> Boolean): List<Double>(source)
inline fun BooleanArray.dropWhile(predicate: (Boolean) -> Boolean): List<Boolean>(source)
inline fun CharArray.dropWhile(predicate: (Char) -> Boolean): List<Char>(source)
inline fun <T> Iterable<T>.dropWhile(predicate: (T) -> Boolean): List<T>(source)

Returns a list containing all elements except first elements that satisfy the given predicate.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val chars = ('a'..'z').toList()
println(chars.drop(23)) // [x, y, z]
println(chars.dropLast(23)) // [a, b, c]
println(chars.dropWhile { it < 'x' }) // [x, y, z]
println(chars.dropLastWhile { it > 'c' }) // [a, b, c] 
   //sampleEnd
}

Returns a list containing all elements except first elements that satisfy the given predicate.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val chars = ('a'..'z').toList()
println(chars.drop(23)) // [x, y, z]
println(chars.dropLast(23)) // [a, b, c]
println(chars.dropWhile { it < 'x' }) // [x, y, z]
println(chars.dropLastWhile { it > 'c' }) // [a, b, c] 
   //sampleEnd
}