get

inline operator fun <T> Array<T>.get(indices: IntRange): Array<T>

Returns the sub-array from the given range.

Example:

arrayOf(1..10)[0..4] // [1, 2, 3, 4, 5]

Since

1.1.0

See also

sliceArray
Array

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun ByteArray.get(indices: IntRange): ByteArray

Returns the sub-array from the given range.

Example:

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

Since

1.1.0

See also

sliceArray
byteArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun CharArray.get(indices: IntRange): CharArray

Returns the sub-array from the given range.

Example:

charArrayOf('a'..'z')[0..4] // ['a', 'b', 'c', 'd', 'e']

Since

1.1.0

See also

sliceArray

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun ShortArray.get(indices: IntRange): ShortArray

Returns the sub-array from the given range.

Example:

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

Since

1.1.0

See also

sliceArray
shortArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun IntArray.get(indices: IntRange): IntArray

Returns the sub-array from the given range.

Example:

intArrayOf(1..10)[0..4] // [1, 2, 3, 4, 5]

Since

1.1.0

See also

sliceArray

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun LongArray.get(indices: IntRange): LongArray

Returns the sub-array from the given range.

Example:

longArrayOf(1..10L)[0..4] // [1L, 2L, 3L, 4L, 5L]

Since

1.1.0

See also

sliceArray

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun FloatArray.get(indices: IntRange): FloatArray

Returns the sub-array from the given range.

Example:

floatArrayOf(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f)[0..4]
// [1.0f, 2.0f, 3.0f, 4.0f, 5.0f]

Since

1.1.0

See also

sliceArray
floatArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun DoubleArray.get(indices: IntRange): DoubleArray

Returns the sub-array from the given range.

Example:

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

Since

1.1.0

See also

sliceArray
doubleArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun BooleanArray.get(indices: IntRange): BooleanArray

Returns the sub-array from the given range.

Example:

booleanArrayOf(true, false, true, false, true, false, true, false, true, false)[0..4]
// [true, false, true, false, true]

Since

1.1.0

See also

sliceArray
booleanArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


inline operator fun <T> Array<T>.get(indices: IntProgression): Array<T>

Returns the sub-array from the given progression.

Example:

arrayOf(1..10)[0..9 step 2] // [1, 3, 5, 7, 9]

Since

1.1.0

See also

sliceArray
Array

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun ByteArray.get(indices: IntProgression): ByteArray

Returns the sub-array from the given progression.

Example:

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

Since

1.1.0

See also

sliceArray
byteArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun CharArray.get(indices: IntProgression): CharArray

Returns the sub-array from the given progression.

Example:

charArrayOf('a'..'z')[0..9 step 2] // ['a', 'c', 'e', 'g', 'i']

Since

1.1.0

See also

sliceArray

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun ShortArray.get(indices: IntProgression): ShortArray

Returns the sub-array from the given progression.

Example:

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

Since

1.1.0

See also

sliceArray
shortArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun IntArray.get(indices: IntProgression): IntArray

Returns the sub-array from the given progression.

Example:

intArrayOf(1..10)[0..9 step 2] // [1, 3, 5, 7, 9]

Since

1.1.0

See also

sliceArray

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun LongArray.get(indices: IntProgression): LongArray

Returns the sub-array from the given progression.

Example:

longArrayOf(1..10L)[0..9 step 2] // [1L, 3L, 5L, 7L, 9L]

Since

1.1.0

See also

sliceArray

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun FloatArray.get(indices: IntProgression): FloatArray

Returns the sub-array from the given progression.

Example:

floatArrayOf(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f)[0..9 step 2]
// [1.0f, 3.0f, 5.0f, 7.0f, 9.0f]

Since

1.1.0

See also

sliceArray
floatArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun DoubleArray.get(indices: IntProgression): DoubleArray

Returns the sub-array from the given progression.

Example:

doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0)[0..9 step 2]
// [1.0, 3.0, 5.0, 7.0, 9.0]

Since

1.1.0

See also

sliceArray
doubleArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


operator fun BooleanArray.get(indices: IntProgression): BooleanArray

Returns the sub-array from the given progression.

Example:

booleanArrayOf(true, false, true, false, true, false, true, false, true, false)[0..9 step 2]
// [true, true, true, true, true]

Since

1.1.0

See also

booleanArrayOf

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


inline operator fun <T> Iterable<T>.get(indices: IntRange): List<T>

Returns the sub-list from the given range.

Example:

listOf(1..10)[0..4] // [1, 2, 3, 4, 5]

Since

1.1.0

See also

slice

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.


inline operator fun <T> Iterable<T>.get(indices: IntProgression): List<T>

Returns the sub-list from the given progression.

Example:

listOf(1..10)[0..9 step 2] // [1, 3, 5, 7, 9]

Since

1.1.0

See also

slice

Throws

IndexOutOfBoundsException

if the range is out of bounds of the array.