head
Returns a list containing first n elements.
Example:
arrayOf(1..10).head(3) // [1, 2, 3]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).head(3) // [1, 2, 3]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
charArrayOf('a'..'z').head(3) // ['a', 'b', 'c']
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
shortArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).head(3) // [1, 2, 3]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
intArrayOf(1..10).head(3) // [1, 2, 3]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
longArrayOf(1..10L).head(3) // [1L, 2L, 3L]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
floatArrayOf(1F, 2F, 3F, 4F, 5F, 6F, 7F, 8F, 9F, 10F).head(3) // [1F, 2F, 3F]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0).head(3) // [1.0, 2.0, 3.0]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
booleanArrayOf(true, false, true, false, true).head(3) // [true, false, true]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.
Returns a list containing first n elements.
Example:
listOf(1..10).head(3) // [1, 2, 3]
Since
1.1.0
Return
sublist
Parameters
number of elements return
See also
Throws
if n is negative.