Document exception thrown for negative n in take/takeLast/drop/dropLast
#KT-29151
This commit is contained in:
@@ -2761,6 +2761,8 @@ public inline fun CharArray.singleOrNull(predicate: (Char) -> Boolean): Char? {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun <T> Array<out T>.drop(n: Int): List<T> {
|
||||
@@ -2771,6 +2773,8 @@ public fun <T> Array<out T>.drop(n: Int): List<T> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun ByteArray.drop(n: Int): List<Byte> {
|
||||
@@ -2781,6 +2785,8 @@ public fun ByteArray.drop(n: Int): List<Byte> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun ShortArray.drop(n: Int): List<Short> {
|
||||
@@ -2791,6 +2797,8 @@ public fun ShortArray.drop(n: Int): List<Short> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun IntArray.drop(n: Int): List<Int> {
|
||||
@@ -2801,6 +2809,8 @@ public fun IntArray.drop(n: Int): List<Int> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun LongArray.drop(n: Int): List<Long> {
|
||||
@@ -2811,6 +2821,8 @@ public fun LongArray.drop(n: Int): List<Long> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun FloatArray.drop(n: Int): List<Float> {
|
||||
@@ -2821,6 +2833,8 @@ public fun FloatArray.drop(n: Int): List<Float> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun DoubleArray.drop(n: Int): List<Double> {
|
||||
@@ -2831,6 +2845,8 @@ public fun DoubleArray.drop(n: Int): List<Double> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun BooleanArray.drop(n: Int): List<Boolean> {
|
||||
@@ -2841,6 +2857,8 @@ public fun BooleanArray.drop(n: Int): List<Boolean> {
|
||||
/**
|
||||
* Returns a list containing all elements except first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun CharArray.drop(n: Int): List<Char> {
|
||||
@@ -2851,6 +2869,8 @@ public fun CharArray.drop(n: Int): List<Char> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun <T> Array<out T>.dropLast(n: Int): List<T> {
|
||||
@@ -2861,6 +2881,8 @@ public fun <T> Array<out T>.dropLast(n: Int): List<T> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun ByteArray.dropLast(n: Int): List<Byte> {
|
||||
@@ -2871,6 +2893,8 @@ public fun ByteArray.dropLast(n: Int): List<Byte> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun ShortArray.dropLast(n: Int): List<Short> {
|
||||
@@ -2881,6 +2905,8 @@ public fun ShortArray.dropLast(n: Int): List<Short> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun IntArray.dropLast(n: Int): List<Int> {
|
||||
@@ -2891,6 +2917,8 @@ public fun IntArray.dropLast(n: Int): List<Int> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun LongArray.dropLast(n: Int): List<Long> {
|
||||
@@ -2901,6 +2929,8 @@ public fun LongArray.dropLast(n: Int): List<Long> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun FloatArray.dropLast(n: Int): List<Float> {
|
||||
@@ -2911,6 +2941,8 @@ public fun FloatArray.dropLast(n: Int): List<Float> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun DoubleArray.dropLast(n: Int): List<Double> {
|
||||
@@ -2921,6 +2953,8 @@ public fun DoubleArray.dropLast(n: Int): List<Double> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun BooleanArray.dropLast(n: Int): List<Boolean> {
|
||||
@@ -2931,6 +2965,8 @@ public fun BooleanArray.dropLast(n: Int): List<Boolean> {
|
||||
/**
|
||||
* Returns a list containing all elements except last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.drop
|
||||
*/
|
||||
public fun CharArray.dropLast(n: Int): List<Char> {
|
||||
@@ -4087,6 +4123,8 @@ public fun CharArray.sliceArray(indices: IntRange): CharArray {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun <T> Array<out T>.take(n: Int): List<T> {
|
||||
@@ -4107,6 +4145,8 @@ public fun <T> Array<out T>.take(n: Int): List<T> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun ByteArray.take(n: Int): List<Byte> {
|
||||
@@ -4127,6 +4167,8 @@ public fun ByteArray.take(n: Int): List<Byte> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun ShortArray.take(n: Int): List<Short> {
|
||||
@@ -4147,6 +4189,8 @@ public fun ShortArray.take(n: Int): List<Short> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun IntArray.take(n: Int): List<Int> {
|
||||
@@ -4167,6 +4211,8 @@ public fun IntArray.take(n: Int): List<Int> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun LongArray.take(n: Int): List<Long> {
|
||||
@@ -4187,6 +4233,8 @@ public fun LongArray.take(n: Int): List<Long> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun FloatArray.take(n: Int): List<Float> {
|
||||
@@ -4207,6 +4255,8 @@ public fun FloatArray.take(n: Int): List<Float> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun DoubleArray.take(n: Int): List<Double> {
|
||||
@@ -4227,6 +4277,8 @@ public fun DoubleArray.take(n: Int): List<Double> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun BooleanArray.take(n: Int): List<Boolean> {
|
||||
@@ -4247,6 +4299,8 @@ public fun BooleanArray.take(n: Int): List<Boolean> {
|
||||
/**
|
||||
* Returns a list containing first [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun CharArray.take(n: Int): List<Char> {
|
||||
@@ -4267,6 +4321,8 @@ public fun CharArray.take(n: Int): List<Char> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun <T> Array<out T>.takeLast(n: Int): List<T> {
|
||||
@@ -4284,6 +4340,8 @@ public fun <T> Array<out T>.takeLast(n: Int): List<T> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun ByteArray.takeLast(n: Int): List<Byte> {
|
||||
@@ -4301,6 +4359,8 @@ public fun ByteArray.takeLast(n: Int): List<Byte> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun ShortArray.takeLast(n: Int): List<Short> {
|
||||
@@ -4318,6 +4378,8 @@ public fun ShortArray.takeLast(n: Int): List<Short> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun IntArray.takeLast(n: Int): List<Int> {
|
||||
@@ -4335,6 +4397,8 @@ public fun IntArray.takeLast(n: Int): List<Int> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun LongArray.takeLast(n: Int): List<Long> {
|
||||
@@ -4352,6 +4416,8 @@ public fun LongArray.takeLast(n: Int): List<Long> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun FloatArray.takeLast(n: Int): List<Float> {
|
||||
@@ -4369,6 +4435,8 @@ public fun FloatArray.takeLast(n: Int): List<Float> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun DoubleArray.takeLast(n: Int): List<Double> {
|
||||
@@ -4386,6 +4454,8 @@ public fun DoubleArray.takeLast(n: Int): List<Double> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun BooleanArray.takeLast(n: Int): List<Boolean> {
|
||||
@@ -4403,6 +4473,8 @@ public fun BooleanArray.takeLast(n: Int): List<Boolean> {
|
||||
/**
|
||||
* Returns a list containing last [n] elements.
|
||||
*
|
||||
* @throws IllegalArgumentException if [n] is negative.
|
||||
*
|
||||
* @sample samples.collections.Collections.Transformations.take
|
||||
*/
|
||||
public fun CharArray.takeLast(n: Int): List<Char> {
|
||||
|
||||
Reference in New Issue
Block a user