tail

inline fun <T> Array<T>.tail(n: Int = 10): List<T>

Returns a list containing last n elements.

Example:

arrayOf(1..10).tail(3) // [8, 9, 10]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop
Array

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun ByteArray.tail(n: Int = 10): List<Byte>

Returns a list containing last n elements.

Example:

byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).tail(3) // [8, 9, 10]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop
byteArrayOf

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun CharArray.tail(n: Int = 10): List<Char>

Returns a list containing last n elements.

Example:

charArrayOf('a'..'z').tail(3) // [x, y, z]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun ShortArray.tail(n: Int = 10): List<Short>

Returns a list containing last n elements.

Example:

shortArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).tail(3) // [8, 9, 10]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop
shortArrayOf

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun IntArray.tail(n: Int = 10): List<Int>

Returns a list containing last n elements.

Example:

intArrayOf(1..10).tail(3) // [8, 9, 10]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun LongArray.tail(n: Int = 10): List<Long>

Returns a list containing last n elements.

Example:

longArrayOf(1..10L).tail(3) // [8L, 9L, 10L]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun FloatArray.tail(n: Int = 10): List<Float>

Returns a list containing last n elements.

Example:

floatArrayOf(1F, 2F, 3F, 4F, 5F, 6F, 7F, 8F, 9F, 10F).tail(3) // [8F, 9F, 10F]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop
floatArrayOf

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun DoubleArray.tail(n: Int = 10): List<Double>

Returns a list containing last n elements.

Example:

doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0).tail(3) // [8.0, 9.0, 10.0]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop
doubleArrayOf

Throws

IllegalArgumentException

if n is negative.


@JvmOverloads
fun BooleanArray.tail(n: Int = 10): List<Boolean>

Returns a list containing last n elements.

Example:

booleanArrayOf(true, false, true, false, true).tail(3) // [true, false, true]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop
booleanArrayOf

Throws

IllegalArgumentException

if n is negative.


inline fun <T> Iterable<T>.tail(n: Int = 10): List<T>

Returns a list containing last n elements.

Example:

listOf(1..10).tail(3) // [8, 9, 10]

Since

1.1.0

Return

sublist

Parameters

n

number of elements return

See also

drop

Throws

IllegalArgumentException

if n is negative.