From 07654eb82bf5cbeebdd420a8e20455017b65a5d6 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sat, 14 Nov 2015 05:56:57 +0300 Subject: [PATCH] StdLib cleanup, deprecated symbol usage: size() and length() --- libraries/stdlib/src/generated/_Arrays.kt | 658 +++++++++--------- .../stdlib/src/generated/_Collections.kt | 50 +- libraries/stdlib/src/generated/_Maps.kt | 6 +- libraries/stdlib/src/generated/_Sets.kt | 10 +- libraries/stdlib/src/generated/_Strings.kt | 52 +- .../stdlib/src/kotlin/collections/Arrays.kt | 6 +- .../stdlib/src/kotlin/collections/JUtil.kt | 36 +- .../src/kotlin/collections/MapWithDefault.kt | 4 +- .../stdlib/src/kotlin/collections/Maps.kt | 8 +- .../src/kotlin/collections/ReversedViews.kt | 6 +- .../stdlib/src/kotlin/collections/Sets.kt | 6 +- .../src/kotlin/io/files/FilePathComponents.kt | 10 +- .../src/kotlin/io/files/FileTreeWalk.kt | 8 +- libraries/stdlib/src/kotlin/io/files/Utils.kt | 6 +- libraries/stdlib/src/kotlin/text/Indent.kt | 10 +- libraries/stdlib/src/kotlin/text/Strings.kt | 78 +-- .../stdlib/src/kotlin/text/StringsJVM.kt | 12 +- .../stdlib/src/kotlin/text/regex/RegexJVM.kt | 4 +- libraries/stdlib/src/kotlin/util/Ordering.kt | 2 +- libraries/stdlib/test/ExceptionTest.kt | 2 +- libraries/stdlib/test/OldStdlibTest.kt | 2 +- libraries/stdlib/test/TuplesTest.kt | 4 +- .../stdlib/test/collections/ArraysJVMTest.kt | 6 +- .../stdlib/test/collections/ArraysTest.kt | 24 +- .../test/collections/CollectionBehaviors.kt | 12 +- .../test/collections/CollectionJVMTest.kt | 18 +- .../stdlib/test/collections/CollectionTest.kt | 40 +- .../stdlib/test/collections/IterableTests.kt | 26 +- .../test/collections/ListBinarySearchTest.kt | 10 +- .../test/collections/ListSpecificTest.kt | 2 +- .../stdlib/test/collections/MapJVMTest.kt | 4 +- libraries/stdlib/test/collections/MapTest.kt | 52 +- .../test/collections/SequenceJVMTest.kt | 2 +- .../stdlib/test/collections/SequenceTest.kt | 6 +- .../test/collections/SetOperationsTest.kt | 2 +- libraries/stdlib/test/io/Files.kt | 22 +- libraries/stdlib/test/js/JsArrayScript.kt | 2 +- libraries/stdlib/test/js/JsArrayTest.kt | 8 +- libraries/stdlib/test/js/MapJsTest.kt | 28 +- libraries/stdlib/test/js/SetJsTest.kt | 24 +- libraries/stdlib/test/text/RegexTest.kt | 2 +- .../stdlib/test/text/StringBuilderTest.kt | 12 +- libraries/stdlib/test/text/StringTest.kt | 8 +- libraries/stdlib/test/utils/TODOTest.kt | 2 +- .../annotation/KotlinAnnotationProvider.kt | 4 +- .../internal/AnnotationProcessingManager.kt | 4 +- .../gradle/plugin/FinishBuildListener.kt | 2 +- .../kotlin/gradle/plugin/KotlinPlugin.kt | 12 +- .../kotlin/gradle/KotlinGradlePluginIT.kt | 2 +- .../src/templates/Aggregates.kt | 4 +- .../kotlin-stdlib-gen/src/templates/Arrays.kt | 8 +- .../src/templates/Elements.kt | 18 +- .../src/templates/Filtering.kt | 24 +- .../src/templates/Generators.kt | 28 +- .../src/templates/Mapping.kt | 8 +- .../src/templates/Ordering.kt | 4 +- .../kotlin-stdlib-gen/src/templates/Sets.kt | 2 +- .../src/templates/Snapshots.kt | 22 +- .../src/templates/SpecialJVM.kt | 26 +- 59 files changed, 730 insertions(+), 730 deletions(-) diff --git a/libraries/stdlib/src/generated/_Arrays.kt b/libraries/stdlib/src/generated/_Arrays.kt index efc3d461127..4cf39d82425 100644 --- a/libraries/stdlib/src/generated/_Arrays.kt +++ b/libraries/stdlib/src/generated/_Arrays.kt @@ -1891,63 +1891,63 @@ public inline fun Array.lastIndexOfRaw(element: Any?): Int { * Returns the last element, or `null` if the array is empty. */ public fun Array.lastOrNull(): T? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun BooleanArray.lastOrNull(): Boolean? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun ByteArray.lastOrNull(): Byte? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun CharArray.lastOrNull(): Char? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun DoubleArray.lastOrNull(): Double? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun FloatArray.lastOrNull(): Float? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun IntArray.lastOrNull(): Int? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun LongArray.lastOrNull(): Long? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** * Returns the last element, or `null` if the array is empty. */ public fun ShortArray.lastOrNull(): Short? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** @@ -2053,7 +2053,7 @@ public inline fun ShortArray.lastOrNull(predicate: (Short) -> Boolean): Short? { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun Array.single(): T { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2064,7 +2064,7 @@ public fun Array.single(): T { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun BooleanArray.single(): Boolean { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2075,7 +2075,7 @@ public fun BooleanArray.single(): Boolean { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun ByteArray.single(): Byte { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2086,7 +2086,7 @@ public fun ByteArray.single(): Byte { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun CharArray.single(): Char { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2097,7 +2097,7 @@ public fun CharArray.single(): Char { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun DoubleArray.single(): Double { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2108,7 +2108,7 @@ public fun DoubleArray.single(): Double { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun FloatArray.single(): Float { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2119,7 +2119,7 @@ public fun FloatArray.single(): Float { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun IntArray.single(): Int { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2130,7 +2130,7 @@ public fun IntArray.single(): Int { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun LongArray.single(): Long { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2141,7 +2141,7 @@ public fun LongArray.single(): Long { * Returns the single element, or throws an exception if the array is empty or has more than one element. */ public fun ShortArray.single(): Short { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -2305,63 +2305,63 @@ public inline fun ShortArray.single(predicate: (Short) -> Boolean): Short { * Returns single element, or `null` if the array is empty or has more than one element. */ public fun Array.singleOrNull(): T? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun BooleanArray.singleOrNull(): Boolean? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun ByteArray.singleOrNull(): Byte? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun CharArray.singleOrNull(): Char? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun DoubleArray.singleOrNull(): Double? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun FloatArray.singleOrNull(): Float? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun IntArray.singleOrNull(): Int? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun LongArray.singleOrNull(): Long? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** * Returns single element, or `null` if the array is empty or has more than one element. */ public fun ShortArray.singleOrNull(): Short? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** @@ -2524,10 +2524,10 @@ public fun Array.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2540,10 +2540,10 @@ public fun BooleanArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2556,10 +2556,10 @@ public fun ByteArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2572,10 +2572,10 @@ public fun CharArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2588,10 +2588,10 @@ public fun DoubleArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2604,10 +2604,10 @@ public fun FloatArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2620,10 +2620,10 @@ public fun IntArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2636,10 +2636,10 @@ public fun LongArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2652,10 +2652,10 @@ public fun ShortArray.drop(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -2666,7 +2666,7 @@ public fun ShortArray.drop(n: Int): List { */ public fun Array.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2674,7 +2674,7 @@ public fun Array.dropLast(n: Int): List { */ public fun BooleanArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2682,7 +2682,7 @@ public fun BooleanArray.dropLast(n: Int): List { */ public fun ByteArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2690,7 +2690,7 @@ public fun ByteArray.dropLast(n: Int): List { */ public fun CharArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2698,7 +2698,7 @@ public fun CharArray.dropLast(n: Int): List { */ public fun DoubleArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2706,7 +2706,7 @@ public fun DoubleArray.dropLast(n: Int): List { */ public fun FloatArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2714,7 +2714,7 @@ public fun FloatArray.dropLast(n: Int): List { */ public fun IntArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2722,7 +2722,7 @@ public fun IntArray.dropLast(n: Int): List { */ public fun LongArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -2730,7 +2730,7 @@ public fun LongArray.dropLast(n: Int): List { */ public fun ShortArray.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -3616,7 +3616,7 @@ public fun ShortArray.slice(indices: Iterable): List { * Returns an array containing elements of this array at specified [indices]. */ public fun Array.sliceArray(indices: Collection): Array { - val result = arrayOfNulls(this, indices.size()) as Array + val result = arrayOfNulls(this, indices.size) as Array var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3628,7 +3628,7 @@ public fun Array.sliceArray(indices: Collection): Array { * Returns an array containing elements of this array at specified [indices]. */ public fun BooleanArray.sliceArray(indices: Collection): BooleanArray { - val result = BooleanArray(indices.size()) + val result = BooleanArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3640,7 +3640,7 @@ public fun BooleanArray.sliceArray(indices: Collection): BooleanArray { * Returns an array containing elements of this array at specified [indices]. */ public fun ByteArray.sliceArray(indices: Collection): ByteArray { - val result = ByteArray(indices.size()) + val result = ByteArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3652,7 +3652,7 @@ public fun ByteArray.sliceArray(indices: Collection): ByteArray { * Returns an array containing elements of this array at specified [indices]. */ public fun CharArray.sliceArray(indices: Collection): CharArray { - val result = CharArray(indices.size()) + val result = CharArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3664,7 +3664,7 @@ public fun CharArray.sliceArray(indices: Collection): CharArray { * Returns an array containing elements of this array at specified [indices]. */ public fun DoubleArray.sliceArray(indices: Collection): DoubleArray { - val result = DoubleArray(indices.size()) + val result = DoubleArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3676,7 +3676,7 @@ public fun DoubleArray.sliceArray(indices: Collection): DoubleArray { * Returns an array containing elements of this array at specified [indices]. */ public fun FloatArray.sliceArray(indices: Collection): FloatArray { - val result = FloatArray(indices.size()) + val result = FloatArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3688,7 +3688,7 @@ public fun FloatArray.sliceArray(indices: Collection): FloatArray { * Returns an array containing elements of this array at specified [indices]. */ public fun IntArray.sliceArray(indices: Collection): IntArray { - val result = IntArray(indices.size()) + val result = IntArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3700,7 +3700,7 @@ public fun IntArray.sliceArray(indices: Collection): IntArray { * Returns an array containing elements of this array at specified [indices]. */ public fun LongArray.sliceArray(indices: Collection): LongArray { - val result = LongArray(indices.size()) + val result = LongArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3712,7 +3712,7 @@ public fun LongArray.sliceArray(indices: Collection): LongArray { * Returns an array containing elements of this array at specified [indices]. */ public fun ShortArray.sliceArray(indices: Collection): ShortArray { - val result = ShortArray(indices.size()) + val result = ShortArray(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -3798,7 +3798,7 @@ public fun ShortArray.sliceArray(indices: IntRange): ShortArray { public fun Array.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3815,7 +3815,7 @@ public fun Array.take(n: Int): List { public fun BooleanArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3832,7 +3832,7 @@ public fun BooleanArray.take(n: Int): List { public fun ByteArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3849,7 +3849,7 @@ public fun ByteArray.take(n: Int): List { public fun CharArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3866,7 +3866,7 @@ public fun CharArray.take(n: Int): List { public fun DoubleArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3883,7 +3883,7 @@ public fun DoubleArray.take(n: Int): List { public fun FloatArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3900,7 +3900,7 @@ public fun FloatArray.take(n: Int): List { public fun IntArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3917,7 +3917,7 @@ public fun IntArray.take(n: Int): List { public fun LongArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3934,7 +3934,7 @@ public fun LongArray.take(n: Int): List { public fun ShortArray.take(n: Int): List { require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -3951,7 +3951,7 @@ public fun ShortArray.take(n: Int): List { public fun Array.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -3965,7 +3965,7 @@ public fun Array.takeLast(n: Int): List { public fun BooleanArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -3979,7 +3979,7 @@ public fun BooleanArray.takeLast(n: Int): List { public fun ByteArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -3993,7 +3993,7 @@ public fun ByteArray.takeLast(n: Int): List { public fun CharArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -4007,7 +4007,7 @@ public fun CharArray.takeLast(n: Int): List { public fun DoubleArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -4021,7 +4021,7 @@ public fun DoubleArray.takeLast(n: Int): List { public fun FloatArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -4035,7 +4035,7 @@ public fun FloatArray.takeLast(n: Int): List { public fun IntArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -4049,7 +4049,7 @@ public fun IntArray.takeLast(n: Int): List { public fun LongArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -4063,7 +4063,7 @@ public fun LongArray.takeLast(n: Int): List { public fun ShortArray.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -4527,7 +4527,7 @@ public fun ShortArray.reversed(): List { */ public fun Array.reversedArray(): Array { if (isEmpty()) return this - val result = arrayOfNulls(this, size()) as Array + val result = arrayOfNulls(this, size) as Array val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4539,7 +4539,7 @@ public fun Array.reversedArray(): Array { */ public fun BooleanArray.reversedArray(): BooleanArray { if (isEmpty()) return this - val result = BooleanArray(size()) + val result = BooleanArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4551,7 +4551,7 @@ public fun BooleanArray.reversedArray(): BooleanArray { */ public fun ByteArray.reversedArray(): ByteArray { if (isEmpty()) return this - val result = ByteArray(size()) + val result = ByteArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4563,7 +4563,7 @@ public fun ByteArray.reversedArray(): ByteArray { */ public fun CharArray.reversedArray(): CharArray { if (isEmpty()) return this - val result = CharArray(size()) + val result = CharArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4575,7 +4575,7 @@ public fun CharArray.reversedArray(): CharArray { */ public fun DoubleArray.reversedArray(): DoubleArray { if (isEmpty()) return this - val result = DoubleArray(size()) + val result = DoubleArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4587,7 +4587,7 @@ public fun DoubleArray.reversedArray(): DoubleArray { */ public fun FloatArray.reversedArray(): FloatArray { if (isEmpty()) return this - val result = FloatArray(size()) + val result = FloatArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4599,7 +4599,7 @@ public fun FloatArray.reversedArray(): FloatArray { */ public fun IntArray.reversedArray(): IntArray { if (isEmpty()) return this - val result = IntArray(size()) + val result = IntArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4611,7 +4611,7 @@ public fun IntArray.reversedArray(): IntArray { */ public fun LongArray.reversedArray(): LongArray { if (isEmpty()) return this - val result = LongArray(size()) + val result = LongArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -4623,7 +4623,7 @@ public fun LongArray.reversedArray(): LongArray { */ public fun ShortArray.reversedArray(): ShortArray { if (isEmpty()) return this - val result = ShortArray(size()) + val result = ShortArray(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -5297,63 +5297,63 @@ public val ShortArray.indices: IntRange * Returns `true` if the array is empty. */ public fun Array.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun BooleanArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun ByteArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun CharArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun DoubleArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun FloatArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun IntArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun LongArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** * Returns `true` if the array is empty. */ public fun ShortArray.isEmpty(): Boolean { - return size() == 0 + return size == 0 } /** @@ -5423,61 +5423,61 @@ public fun ShortArray.isNotEmpty(): Boolean { * Returns the last valid index for the array. */ public val Array.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val BooleanArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val ByteArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val CharArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val DoubleArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val FloatArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val IntArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val LongArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns the last valid index for the array. */ public val ShortArray.lastIndex: Int - get() = size() - 1 + get() = size - 1 /** * Returns an array of Boolean containing all of the elements of this generic array. */ public fun Array.toBooleanArray(): BooleanArray { - val result = BooleanArray(size()) + val result = BooleanArray(size) for (index in indices) result[index] = this[index] return result @@ -5487,7 +5487,7 @@ public fun Array.toBooleanArray(): BooleanArray { * Returns an array of Byte containing all of the elements of this generic array. */ public fun Array.toByteArray(): ByteArray { - val result = ByteArray(size()) + val result = ByteArray(size) for (index in indices) result[index] = this[index] return result @@ -5497,7 +5497,7 @@ public fun Array.toByteArray(): ByteArray { * Returns an array of Char containing all of the elements of this generic array. */ public fun Array.toCharArray(): CharArray { - val result = CharArray(size()) + val result = CharArray(size) for (index in indices) result[index] = this[index] return result @@ -5507,7 +5507,7 @@ public fun Array.toCharArray(): CharArray { * Returns an array of Double containing all of the elements of this generic array. */ public fun Array.toDoubleArray(): DoubleArray { - val result = DoubleArray(size()) + val result = DoubleArray(size) for (index in indices) result[index] = this[index] return result @@ -5517,7 +5517,7 @@ public fun Array.toDoubleArray(): DoubleArray { * Returns an array of Float containing all of the elements of this generic array. */ public fun Array.toFloatArray(): FloatArray { - val result = FloatArray(size()) + val result = FloatArray(size) for (index in indices) result[index] = this[index] return result @@ -5527,7 +5527,7 @@ public fun Array.toFloatArray(): FloatArray { * Returns an array of Int containing all of the elements of this generic array. */ public fun Array.toIntArray(): IntArray { - val result = IntArray(size()) + val result = IntArray(size) for (index in indices) result[index] = this[index] return result @@ -5537,7 +5537,7 @@ public fun Array.toIntArray(): IntArray { * Returns an array of Long containing all of the elements of this generic array. */ public fun Array.toLongArray(): LongArray { - val result = LongArray(size()) + val result = LongArray(size) for (index in indices) result[index] = this[index] return result @@ -5547,7 +5547,7 @@ public fun Array.toLongArray(): LongArray { * Returns an array of Short containing all of the elements of this generic array. */ public fun Array.toShortArray(): ShortArray { - val result = ShortArray(size()) + val result = ShortArray(size) for (index in indices) result[index] = this[index] return result @@ -5564,7 +5564,7 @@ public fun Array.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun BooleanArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5573,7 +5573,7 @@ public fun BooleanArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun ByteArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5582,7 +5582,7 @@ public fun ByteArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun CharArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5591,7 +5591,7 @@ public fun CharArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun DoubleArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5600,7 +5600,7 @@ public fun DoubleArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun FloatArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5609,7 +5609,7 @@ public fun FloatArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun IntArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5618,7 +5618,7 @@ public fun IntArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun LongArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5627,7 +5627,7 @@ public fun LongArray.toArrayList(): ArrayList { * Returns an [ArrayList] of all elements. */ public fun ShortArray.toArrayList(): ArrayList { - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list } @@ -5726,63 +5726,63 @@ public fun > ShortArray.toCollection(collection: * Returns a [HashSet] of all elements. */ public fun Array.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun BooleanArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun ByteArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun CharArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun DoubleArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun FloatArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun IntArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun LongArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** * Returns a [HashSet] of all elements. */ public fun ShortArray.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(size()))) + return toCollection(HashSet(mapCapacity(size))) } /** @@ -5970,7 +5970,7 @@ public inline fun ShortArray.toMap(selector: (Short) -> K): Map { * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Array.toMap(selector: (T) -> K, transform: (T) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -5983,7 +5983,7 @@ public inline fun Array.toMap(selector: (T) -> K, transform: (T * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun BooleanArray.toMap(selector: (Boolean) -> K, transform: (Boolean) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -5996,7 +5996,7 @@ public inline fun BooleanArray.toMap(selector: (Boolean) -> K, transform: * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun ByteArray.toMap(selector: (Byte) -> K, transform: (Byte) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6009,7 +6009,7 @@ public inline fun ByteArray.toMap(selector: (Byte) -> K, transform: (Byte * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharArray.toMap(selector: (Char) -> K, transform: (Char) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6022,7 +6022,7 @@ public inline fun CharArray.toMap(selector: (Char) -> K, transform: (Char * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun DoubleArray.toMap(selector: (Double) -> K, transform: (Double) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6035,7 +6035,7 @@ public inline fun DoubleArray.toMap(selector: (Double) -> K, transform: ( * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun FloatArray.toMap(selector: (Float) -> K, transform: (Float) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6048,7 +6048,7 @@ public inline fun FloatArray.toMap(selector: (Float) -> K, transform: (Fl * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun IntArray.toMap(selector: (Int) -> K, transform: (Int) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6061,7 +6061,7 @@ public inline fun IntArray.toMap(selector: (Int) -> K, transform: (Int) - * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun LongArray.toMap(selector: (Long) -> K, transform: (Long) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6074,7 +6074,7 @@ public inline fun LongArray.toMap(selector: (Long) -> K, transform: (Long * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun ShortArray.toMap(selector: (Short) -> K, transform: (Short) -> V): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -6088,7 +6088,7 @@ public inline fun ShortArray.toMap(selector: (Short) -> K, transform: (Sh * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun Array.toMapBy(selector: (T) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6102,7 +6102,7 @@ public inline fun Array.toMapBy(selector: (T) -> K): Map { * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun BooleanArray.toMapBy(selector: (Boolean) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6116,7 +6116,7 @@ public inline fun BooleanArray.toMapBy(selector: (Boolean) -> K): Map ByteArray.toMapBy(selector: (Byte) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6130,7 +6130,7 @@ public inline fun ByteArray.toMapBy(selector: (Byte) -> K): Map { * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharArray.toMapBy(selector: (Char) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6144,7 +6144,7 @@ public inline fun CharArray.toMapBy(selector: (Char) -> K): Map { * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun DoubleArray.toMapBy(selector: (Double) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6158,7 +6158,7 @@ public inline fun DoubleArray.toMapBy(selector: (Double) -> K): Map FloatArray.toMapBy(selector: (Float) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6172,7 +6172,7 @@ public inline fun FloatArray.toMapBy(selector: (Float) -> K): Map * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun IntArray.toMapBy(selector: (Int) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6186,7 +6186,7 @@ public inline fun IntArray.toMapBy(selector: (Int) -> K): Map { * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun LongArray.toMapBy(selector: (Long) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6200,7 +6200,7 @@ public inline fun LongArray.toMapBy(selector: (Long) -> K): Map { * If any two elements would have the same key returned by [selector] the last one gets added to the map. */ public inline fun ShortArray.toMapBy(selector: (Short) -> K): Map { - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -6212,63 +6212,63 @@ public inline fun ShortArray.toMapBy(selector: (Short) -> K): Map * Returns a [Set] of all elements. */ public fun Array.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun BooleanArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun ByteArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun CharArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun DoubleArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun FloatArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun IntArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun LongArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** * Returns a [Set] of all elements. */ public fun ShortArray.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(size()))) + return toCollection(LinkedHashSet(mapCapacity(size))) } /** @@ -6672,7 +6672,7 @@ public inline fun ShortArray.groupByTo(map: MutableMap * to each element in the original array. */ public inline fun Array.map(transform: (T) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6680,7 +6680,7 @@ public inline fun Array.map(transform: (T) -> R): List { * to each element in the original array. */ public inline fun BooleanArray.map(transform: (Boolean) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6688,7 +6688,7 @@ public inline fun BooleanArray.map(transform: (Boolean) -> R): List { * to each element in the original array. */ public inline fun ByteArray.map(transform: (Byte) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6696,7 +6696,7 @@ public inline fun ByteArray.map(transform: (Byte) -> R): List { * to each element in the original array. */ public inline fun CharArray.map(transform: (Char) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6704,7 +6704,7 @@ public inline fun CharArray.map(transform: (Char) -> R): List { * to each element in the original array. */ public inline fun DoubleArray.map(transform: (Double) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6712,7 +6712,7 @@ public inline fun DoubleArray.map(transform: (Double) -> R): List { * to each element in the original array. */ public inline fun FloatArray.map(transform: (Float) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6720,7 +6720,7 @@ public inline fun FloatArray.map(transform: (Float) -> R): List { * to each element in the original array. */ public inline fun IntArray.map(transform: (Int) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6728,7 +6728,7 @@ public inline fun IntArray.map(transform: (Int) -> R): List { * to each element in the original array. */ public inline fun LongArray.map(transform: (Long) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6736,7 +6736,7 @@ public inline fun LongArray.map(transform: (Long) -> R): List { * to each element in the original array. */ public inline fun ShortArray.map(transform: (Short) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -6744,7 +6744,7 @@ public inline fun ShortArray.map(transform: (Short) -> R): List { * to each element and its index in the original array. */ public inline fun Array.mapIndexed(transform: (Int, T) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6752,7 +6752,7 @@ public inline fun Array.mapIndexed(transform: (Int, T) -> R): List * to each element and its index in the original array. */ public inline fun BooleanArray.mapIndexed(transform: (Int, Boolean) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6760,7 +6760,7 @@ public inline fun BooleanArray.mapIndexed(transform: (Int, Boolean) -> R): L * to each element and its index in the original array. */ public inline fun ByteArray.mapIndexed(transform: (Int, Byte) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6768,7 +6768,7 @@ public inline fun ByteArray.mapIndexed(transform: (Int, Byte) -> R): List * to each element and its index in the original array. */ public inline fun CharArray.mapIndexed(transform: (Int, Char) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6776,7 +6776,7 @@ public inline fun CharArray.mapIndexed(transform: (Int, Char) -> R): List * to each element and its index in the original array. */ public inline fun DoubleArray.mapIndexed(transform: (Int, Double) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6784,7 +6784,7 @@ public inline fun DoubleArray.mapIndexed(transform: (Int, Double) -> R): Lis * to each element and its index in the original array. */ public inline fun FloatArray.mapIndexed(transform: (Int, Float) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6792,7 +6792,7 @@ public inline fun FloatArray.mapIndexed(transform: (Int, Float) -> R): List< * to each element and its index in the original array. */ public inline fun IntArray.mapIndexed(transform: (Int, Int) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6800,7 +6800,7 @@ public inline fun IntArray.mapIndexed(transform: (Int, Int) -> R): List { * to each element and its index in the original array. */ public inline fun LongArray.mapIndexed(transform: (Int, Long) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -6808,7 +6808,7 @@ public inline fun LongArray.mapIndexed(transform: (Int, Long) -> R): List * to each element and its index in the original array. */ public inline fun ShortArray.mapIndexed(transform: (Int, Short) -> R): List { - return mapIndexedTo(ArrayList(size()), transform) + return mapIndexedTo(ArrayList(size), transform) } /** @@ -7470,7 +7470,7 @@ public fun ShortArray.subtract(other: Iterable): Set { * Returns a mutable set containing all distinct elements from the given array. */ public fun Array.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7479,7 +7479,7 @@ public fun Array.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun BooleanArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7488,7 +7488,7 @@ public fun BooleanArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun ByteArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7497,7 +7497,7 @@ public fun ByteArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun CharArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7506,7 +7506,7 @@ public fun CharArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun DoubleArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7515,7 +7515,7 @@ public fun DoubleArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun FloatArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7524,7 +7524,7 @@ public fun FloatArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun IntArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7533,7 +7533,7 @@ public fun IntArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun LongArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7542,7 +7542,7 @@ public fun LongArray.toMutableSet(): MutableSet { * Returns a mutable set containing all distinct elements from the given array. */ public fun ShortArray.toMutableSet(): MutableSet { - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set } @@ -7848,63 +7848,63 @@ public inline fun ShortArray.any(predicate: (Short) -> Boolean): Boolean { * Returns the number of elements in this array. */ public fun Array.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun BooleanArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun ByteArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun CharArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun DoubleArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun FloatArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun IntArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun LongArray.count(): Int { - return size() + return size } /** * Returns the number of elements in this array. */ public fun ShortArray.count(): Int { - return size() + return size } /** @@ -9661,7 +9661,7 @@ public fun ShortArray.zip(array: Array): List> { * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun Array.zip(array: Array, transform: (T, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9673,7 +9673,7 @@ public inline fun Array.zip(array: Array, transform: (T, * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun BooleanArray.zip(array: Array, transform: (Boolean, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9685,7 +9685,7 @@ public inline fun BooleanArray.zip(array: Array, transform: (Boole * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun ByteArray.zip(array: Array, transform: (Byte, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9697,7 +9697,7 @@ public inline fun ByteArray.zip(array: Array, transform: (Byte, R) * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun CharArray.zip(array: Array, transform: (Char, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9709,7 +9709,7 @@ public inline fun CharArray.zip(array: Array, transform: (Char, R) * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun DoubleArray.zip(array: Array, transform: (Double, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9721,7 +9721,7 @@ public inline fun DoubleArray.zip(array: Array, transform: (Double * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun FloatArray.zip(array: Array, transform: (Float, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9733,7 +9733,7 @@ public inline fun FloatArray.zip(array: Array, transform: (Float, * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun IntArray.zip(array: Array, transform: (Int, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9745,7 +9745,7 @@ public inline fun IntArray.zip(array: Array, transform: (Int, R) - * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun LongArray.zip(array: Array, transform: (Long, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9757,7 +9757,7 @@ public inline fun LongArray.zip(array: Array, transform: (Long, R) * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun ShortArray.zip(array: Array, transform: (Short, R) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9825,7 +9825,7 @@ public fun ShortArray.zip(array: ShortArray): List> { * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun BooleanArray.zip(array: BooleanArray, transform: (Boolean, Boolean) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9837,7 +9837,7 @@ public inline fun BooleanArray.zip(array: BooleanArray, transform: (Boolean, * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun ByteArray.zip(array: ByteArray, transform: (Byte, Byte) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9849,7 +9849,7 @@ public inline fun ByteArray.zip(array: ByteArray, transform: (Byte, Byte) -> * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun CharArray.zip(array: CharArray, transform: (Char, Char) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9861,7 +9861,7 @@ public inline fun CharArray.zip(array: CharArray, transform: (Char, Char) -> * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun DoubleArray.zip(array: DoubleArray, transform: (Double, Double) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9873,7 +9873,7 @@ public inline fun DoubleArray.zip(array: DoubleArray, transform: (Double, Do * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun FloatArray.zip(array: FloatArray, transform: (Float, Float) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9885,7 +9885,7 @@ public inline fun FloatArray.zip(array: FloatArray, transform: (Float, Float * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun IntArray.zip(array: IntArray, transform: (Int, Int) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9897,7 +9897,7 @@ public inline fun IntArray.zip(array: IntArray, transform: (Int, Int) -> V): * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun LongArray.zip(array: LongArray, transform: (Long, Long) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9909,7 +9909,7 @@ public inline fun LongArray.zip(array: LongArray, transform: (Long, Long) -> * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun ShortArray.zip(array: ShortArray, transform: (Short, Short) -> V): List { - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -9984,7 +9984,7 @@ public fun ShortArray.zip(other: Iterable): List> { * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun Array.zip(other: Iterable, transform: (T, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -9998,7 +9998,7 @@ public inline fun Array.zip(other: Iterable, transform: (T, * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun BooleanArray.zip(other: Iterable, transform: (Boolean, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10012,7 +10012,7 @@ public inline fun BooleanArray.zip(other: Iterable, transform: (Boolea * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun ByteArray.zip(other: Iterable, transform: (Byte, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10026,7 +10026,7 @@ public inline fun ByteArray.zip(other: Iterable, transform: (Byte, R) * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun CharArray.zip(other: Iterable, transform: (Char, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10040,7 +10040,7 @@ public inline fun CharArray.zip(other: Iterable, transform: (Char, R) * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun DoubleArray.zip(other: Iterable, transform: (Double, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10054,7 +10054,7 @@ public inline fun DoubleArray.zip(other: Iterable, transform: (Double, * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun FloatArray.zip(other: Iterable, transform: (Float, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10068,7 +10068,7 @@ public inline fun FloatArray.zip(other: Iterable, transform: (Float, R * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun IntArray.zip(other: Iterable, transform: (Int, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10082,7 +10082,7 @@ public inline fun IntArray.zip(other: Iterable, transform: (Int, R) -> * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun LongArray.zip(other: Iterable, transform: (Long, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10096,7 +10096,7 @@ public inline fun LongArray.zip(other: Iterable, transform: (Long, R) * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun ShortArray.zip(other: Iterable, transform: (Short, R) -> V): List { - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -10597,7 +10597,7 @@ public fun Array.asList(): List { @kotlin.jvm.JvmVersion public fun BooleanArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Boolean): Boolean = this@asList.contains(o) override fun get(index: Int): Boolean = this@asList[index] @@ -10612,7 +10612,7 @@ public fun BooleanArray.asList(): List { @kotlin.jvm.JvmVersion public fun ByteArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Byte): Boolean = this@asList.contains(o) override fun get(index: Int): Byte = this@asList[index] @@ -10627,7 +10627,7 @@ public fun ByteArray.asList(): List { @kotlin.jvm.JvmVersion public fun CharArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Char): Boolean = this@asList.contains(o) override fun get(index: Int): Char = this@asList[index] @@ -10642,7 +10642,7 @@ public fun CharArray.asList(): List { @kotlin.jvm.JvmVersion public fun DoubleArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Double): Boolean = this@asList.contains(o) override fun get(index: Int): Double = this@asList[index] @@ -10657,7 +10657,7 @@ public fun DoubleArray.asList(): List { @kotlin.jvm.JvmVersion public fun FloatArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Float): Boolean = this@asList.contains(o) override fun get(index: Int): Float = this@asList[index] @@ -10672,7 +10672,7 @@ public fun FloatArray.asList(): List { @kotlin.jvm.JvmVersion public fun IntArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Int): Boolean = this@asList.contains(o) override fun get(index: Int): Int = this@asList[index] @@ -10687,7 +10687,7 @@ public fun IntArray.asList(): List { @kotlin.jvm.JvmVersion public fun LongArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Long): Boolean = this@asList.contains(o) override fun get(index: Int): Long = this@asList[index] @@ -10702,7 +10702,7 @@ public fun LongArray.asList(): List { @kotlin.jvm.JvmVersion public fun ShortArray.asList(): List { return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: Short): Boolean = this@asList.contains(o) override fun get(index: Int): Short = this@asList[index] @@ -10715,7 +10715,7 @@ public fun ShortArray.asList(): List { * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted according to the specified [comparator]. */ @kotlin.jvm.JvmVersion -public fun Array.binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun Array.binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element, comparator) } @@ -10723,7 +10723,7 @@ public fun Array.binarySearch(element: T, comparator: Comparator Array.binarySearch(element: T, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun Array.binarySearch(element: T, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10731,7 +10731,7 @@ public fun Array.binarySearch(element: T, fromIndex: Int = 0, toIndex * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun ByteArray.binarySearch(element: Byte, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun ByteArray.binarySearch(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10739,7 +10739,7 @@ public fun ByteArray.binarySearch(element: Byte, fromIndex: Int = 0, toIndex: In * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun CharArray.binarySearch(element: Char, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun CharArray.binarySearch(element: Char, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10747,7 +10747,7 @@ public fun CharArray.binarySearch(element: Char, fromIndex: Int = 0, toIndex: In * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10755,7 +10755,7 @@ public fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun FloatArray.binarySearch(element: Float, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun FloatArray.binarySearch(element: Float, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10763,7 +10763,7 @@ public fun FloatArray.binarySearch(element: Float, fromIndex: Int = 0, toIndex: * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun IntArray.binarySearch(element: Int, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun IntArray.binarySearch(element: Int, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10771,7 +10771,7 @@ public fun IntArray.binarySearch(element: Int, fromIndex: Int = 0, toIndex: Int * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun LongArray.binarySearch(element: Long, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun LongArray.binarySearch(element: Long, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10779,7 +10779,7 @@ public fun LongArray.binarySearch(element: Long, fromIndex: Int = 0, toIndex: In * Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted. */ @kotlin.jvm.JvmVersion -public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex: Int = size()): Int { +public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex: Int = size): Int { return Arrays.binarySearch(this, fromIndex, toIndex, element) } @@ -10788,7 +10788,7 @@ public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex: */ @kotlin.jvm.JvmVersion public fun Array.copyOf(): Array { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10796,7 +10796,7 @@ public fun Array.copyOf(): Array { */ @kotlin.jvm.JvmVersion public fun BooleanArray.copyOf(): BooleanArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10804,7 +10804,7 @@ public fun BooleanArray.copyOf(): BooleanArray { */ @kotlin.jvm.JvmVersion public fun ByteArray.copyOf(): ByteArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10812,7 +10812,7 @@ public fun ByteArray.copyOf(): ByteArray { */ @kotlin.jvm.JvmVersion public fun CharArray.copyOf(): CharArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10820,7 +10820,7 @@ public fun CharArray.copyOf(): CharArray { */ @kotlin.jvm.JvmVersion public fun DoubleArray.copyOf(): DoubleArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10828,7 +10828,7 @@ public fun DoubleArray.copyOf(): DoubleArray { */ @kotlin.jvm.JvmVersion public fun FloatArray.copyOf(): FloatArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10836,7 +10836,7 @@ public fun FloatArray.copyOf(): FloatArray { */ @kotlin.jvm.JvmVersion public fun IntArray.copyOf(): IntArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10844,7 +10844,7 @@ public fun IntArray.copyOf(): IntArray { */ @kotlin.jvm.JvmVersion public fun LongArray.copyOf(): LongArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10852,7 +10852,7 @@ public fun LongArray.copyOf(): LongArray { */ @kotlin.jvm.JvmVersion public fun ShortArray.copyOf(): ShortArray { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -10861,7 +10861,7 @@ public fun ShortArray.copyOf(): ShortArray { @kotlin.jvm.JvmVersion @JvmName("mutableCopyOf") public fun Array.copyOf(): Array { - return Arrays.copyOf(this, size()) + return Arrays.copyOf(this, size) } /** @@ -11030,7 +11030,7 @@ public fun Array.copyOfRange(fromIndex: Int, toIndex: Int): Array { * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11038,7 +11038,7 @@ public fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11046,7 +11046,7 @@ public fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11054,7 +11054,7 @@ public fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11062,7 +11062,7 @@ public fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11070,7 +11070,7 @@ public fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = si * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11078,7 +11078,7 @@ public fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size() * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11086,7 +11086,7 @@ public fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11094,7 +11094,7 @@ public fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = si * Fills original array with the provided value. */ @kotlin.jvm.JvmVersion -public fun Array.fill(element: T, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun Array.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.fill(this, fromIndex, toIndex, element) } @@ -11137,8 +11137,8 @@ public fun , R> Array<*>.filterIsInstanceTo(destinat */ @kotlin.jvm.JvmVersion public operator fun BooleanArray.plus(array: BooleanArray): BooleanArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11149,8 +11149,8 @@ public operator fun BooleanArray.plus(array: BooleanArray): BooleanArray { */ @kotlin.jvm.JvmVersion public operator fun ByteArray.plus(array: ByteArray): ByteArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11161,8 +11161,8 @@ public operator fun ByteArray.plus(array: ByteArray): ByteArray { */ @kotlin.jvm.JvmVersion public operator fun CharArray.plus(array: CharArray): CharArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11173,8 +11173,8 @@ public operator fun CharArray.plus(array: CharArray): CharArray { */ @kotlin.jvm.JvmVersion public operator fun DoubleArray.plus(array: DoubleArray): DoubleArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11185,8 +11185,8 @@ public operator fun DoubleArray.plus(array: DoubleArray): DoubleArray { */ @kotlin.jvm.JvmVersion public operator fun FloatArray.plus(array: FloatArray): FloatArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11197,8 +11197,8 @@ public operator fun FloatArray.plus(array: FloatArray): FloatArray { */ @kotlin.jvm.JvmVersion public operator fun IntArray.plus(array: IntArray): IntArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11209,8 +11209,8 @@ public operator fun IntArray.plus(array: IntArray): IntArray { */ @kotlin.jvm.JvmVersion public operator fun LongArray.plus(array: LongArray): LongArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11221,8 +11221,8 @@ public operator fun LongArray.plus(array: LongArray): LongArray { */ @kotlin.jvm.JvmVersion public operator fun ShortArray.plus(array: ShortArray): ShortArray { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11233,8 +11233,8 @@ public operator fun ShortArray.plus(array: ShortArray): ShortArray { */ @kotlin.jvm.JvmVersion public operator fun Array.plus(array: Array): Array { - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -11245,8 +11245,8 @@ public operator fun Array.plus(array: Array): Array { */ @kotlin.jvm.JvmVersion public operator fun BooleanArray.plus(collection: Collection): BooleanArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11256,8 +11256,8 @@ public operator fun BooleanArray.plus(collection: Collection): BooleanA */ @kotlin.jvm.JvmVersion public operator fun ByteArray.plus(collection: Collection): ByteArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11267,8 +11267,8 @@ public operator fun ByteArray.plus(collection: Collection): ByteArray { */ @kotlin.jvm.JvmVersion public operator fun CharArray.plus(collection: Collection): CharArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11278,8 +11278,8 @@ public operator fun CharArray.plus(collection: Collection): CharArray { */ @kotlin.jvm.JvmVersion public operator fun DoubleArray.plus(collection: Collection): DoubleArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11289,8 +11289,8 @@ public operator fun DoubleArray.plus(collection: Collection): DoubleArra */ @kotlin.jvm.JvmVersion public operator fun FloatArray.plus(collection: Collection): FloatArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11300,8 +11300,8 @@ public operator fun FloatArray.plus(collection: Collection): FloatArray { */ @kotlin.jvm.JvmVersion public operator fun IntArray.plus(collection: Collection): IntArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11311,8 +11311,8 @@ public operator fun IntArray.plus(collection: Collection): IntArray { */ @kotlin.jvm.JvmVersion public operator fun LongArray.plus(collection: Collection): LongArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11322,8 +11322,8 @@ public operator fun LongArray.plus(collection: Collection): LongArray { */ @kotlin.jvm.JvmVersion public operator fun ShortArray.plus(collection: Collection): ShortArray { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11333,8 +11333,8 @@ public operator fun ShortArray.plus(collection: Collection): ShortArray { */ @kotlin.jvm.JvmVersion public operator fun Array.plus(collection: Collection): Array { - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result } @@ -11344,7 +11344,7 @@ public operator fun Array.plus(collection: Collection): Array { */ @kotlin.jvm.JvmVersion public operator fun BooleanArray.plus(element: Boolean): BooleanArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11355,7 +11355,7 @@ public operator fun BooleanArray.plus(element: Boolean): BooleanArray { */ @kotlin.jvm.JvmVersion public operator fun ByteArray.plus(element: Byte): ByteArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11366,7 +11366,7 @@ public operator fun ByteArray.plus(element: Byte): ByteArray { */ @kotlin.jvm.JvmVersion public operator fun CharArray.plus(element: Char): CharArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11377,7 +11377,7 @@ public operator fun CharArray.plus(element: Char): CharArray { */ @kotlin.jvm.JvmVersion public operator fun DoubleArray.plus(element: Double): DoubleArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11388,7 +11388,7 @@ public operator fun DoubleArray.plus(element: Double): DoubleArray { */ @kotlin.jvm.JvmVersion public operator fun FloatArray.plus(element: Float): FloatArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11399,7 +11399,7 @@ public operator fun FloatArray.plus(element: Float): FloatArray { */ @kotlin.jvm.JvmVersion public operator fun IntArray.plus(element: Int): IntArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11410,7 +11410,7 @@ public operator fun IntArray.plus(element: Int): IntArray { */ @kotlin.jvm.JvmVersion public operator fun LongArray.plus(element: Long): LongArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11421,7 +11421,7 @@ public operator fun LongArray.plus(element: Long): LongArray { */ @kotlin.jvm.JvmVersion public operator fun ShortArray.plus(element: Short): ShortArray { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11432,7 +11432,7 @@ public operator fun ShortArray.plus(element: Short): ShortArray { */ @kotlin.jvm.JvmVersion public operator fun Array.plus(element: T): Array { - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -11506,7 +11506,7 @@ public fun ShortArray.sort(): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun Array.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun Array.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11514,7 +11514,7 @@ public fun Array.sort(fromIndex: Int = 0, toIndex: Int = size()): Uni * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11522,7 +11522,7 @@ public fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11530,7 +11530,7 @@ public fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11538,7 +11538,7 @@ public fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11546,7 +11546,7 @@ public fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11554,7 +11554,7 @@ public fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11562,7 +11562,7 @@ public fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { * Sorts a range in the array in-place. */ @kotlin.jvm.JvmVersion -public fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex) } @@ -11578,7 +11578,7 @@ public fun Array.sortWith(comparator: Comparator): Unit { * Sorts a range in the array in-place with the given [comparator]. */ @kotlin.jvm.JvmVersion -public fun Array.sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size()): Unit { +public fun Array.sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Unit { Arrays.sort(this, fromIndex, toIndex, comparator) } @@ -11587,7 +11587,7 @@ public fun Array.sortWith(comparator: Comparator, fromIndex: In */ @kotlin.jvm.JvmVersion public fun BooleanArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11598,7 +11598,7 @@ public fun BooleanArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun ByteArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11609,7 +11609,7 @@ public fun ByteArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun CharArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11620,7 +11620,7 @@ public fun CharArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun DoubleArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11631,7 +11631,7 @@ public fun DoubleArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun FloatArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11642,7 +11642,7 @@ public fun FloatArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun IntArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11653,7 +11653,7 @@ public fun IntArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun LongArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array @@ -11664,7 +11664,7 @@ public fun LongArray.toTypedArray(): Array { */ @kotlin.jvm.JvmVersion public fun ShortArray.toTypedArray(): Array { - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array diff --git a/libraries/stdlib/src/generated/_Collections.kt b/libraries/stdlib/src/generated/_Collections.kt index c708e728a6e..dab84510ec0 100644 --- a/libraries/stdlib/src/generated/_Collections.kt +++ b/libraries/stdlib/src/generated/_Collections.kt @@ -464,7 +464,7 @@ public inline fun List.lastIndexOfRaw(element: Any?): Int { */ public fun Iterable.lastOrNull(): T? { when (this) { - is List -> return if (isEmpty()) null else this[size() - 1] + is List -> return if (isEmpty()) null else this[size - 1] else -> { val iterator = iterator() if (!iterator.hasNext()) @@ -481,7 +481,7 @@ public fun Iterable.lastOrNull(): T? { * Returns the last element, or `null` if the list is empty. */ public fun List.lastOrNull(): T? { - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] } /** @@ -515,7 +515,7 @@ public inline fun List.lastOrNull(predicate: (T) -> Boolean): T? { */ public fun Iterable.single(): T { when (this) { - is List -> return when (size()) { + is List -> return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -536,7 +536,7 @@ public fun Iterable.single(): T { * Returns the single element, or throws an exception if the list is empty or has more than one element. */ public fun List.single(): T { - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -565,7 +565,7 @@ public inline fun Iterable.single(predicate: (T) -> Boolean): T { */ public fun Iterable.singleOrNull(): T? { when (this) { - is List -> return if (size() == 1) this[0] else null + is List -> return if (size == 1) this[0] else null else -> { val iterator = iterator() if (!iterator.hasNext()) @@ -582,7 +582,7 @@ public fun Iterable.singleOrNull(): T? { * Returns single element, or `null` if the list is empty or has more than one element. */ public fun List.singleOrNull(): T? { - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null } /** @@ -610,12 +610,12 @@ public fun Iterable.drop(n: Int): List { if (n == 0) return toList() val list: ArrayList if (this is Collection<*>) { - val resultSize = size() - n + val resultSize = size - n if (resultSize <= 0) return emptyList() list = ArrayList(resultSize) if (this is List) { - for (index in n..size() - 1) { + for (index in n..size - 1) { list.add(this[index]) } return list @@ -636,7 +636,7 @@ public fun Iterable.drop(n: Int): List { */ public fun List.dropLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) } /** @@ -756,7 +756,7 @@ public fun List.slice(indices: Iterable): List { public fun Iterable.take(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - if (this is Collection && n >= size()) return toList() + if (this is Collection && n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -773,7 +773,7 @@ public fun Iterable.take(n: Int): List { public fun List.takeLast(n: Int): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -891,7 +891,7 @@ public fun Iterable.sortedWith(comparator: Comparator): List { * Returns an array of Boolean containing all of the elements of this collection. */ public fun Collection.toBooleanArray(): BooleanArray { - val result = BooleanArray(size()) + val result = BooleanArray(size) var index = 0 for (element in this) result[index++] = element @@ -902,7 +902,7 @@ public fun Collection.toBooleanArray(): BooleanArray { * Returns an array of Byte containing all of the elements of this collection. */ public fun Collection.toByteArray(): ByteArray { - val result = ByteArray(size()) + val result = ByteArray(size) var index = 0 for (element in this) result[index++] = element @@ -913,7 +913,7 @@ public fun Collection.toByteArray(): ByteArray { * Returns an array of Char containing all of the elements of this collection. */ public fun Collection.toCharArray(): CharArray { - val result = CharArray(size()) + val result = CharArray(size) var index = 0 for (element in this) result[index++] = element @@ -924,7 +924,7 @@ public fun Collection.toCharArray(): CharArray { * Returns an array of Double containing all of the elements of this collection. */ public fun Collection.toDoubleArray(): DoubleArray { - val result = DoubleArray(size()) + val result = DoubleArray(size) var index = 0 for (element in this) result[index++] = element @@ -935,7 +935,7 @@ public fun Collection.toDoubleArray(): DoubleArray { * Returns an array of Float containing all of the elements of this collection. */ public fun Collection.toFloatArray(): FloatArray { - val result = FloatArray(size()) + val result = FloatArray(size) var index = 0 for (element in this) result[index++] = element @@ -946,7 +946,7 @@ public fun Collection.toFloatArray(): FloatArray { * Returns an array of Int containing all of the elements of this collection. */ public fun Collection.toIntArray(): IntArray { - val result = IntArray(size()) + val result = IntArray(size) var index = 0 for (element in this) result[index++] = element @@ -957,7 +957,7 @@ public fun Collection.toIntArray(): IntArray { * Returns an array of Long containing all of the elements of this collection. */ public fun Collection.toLongArray(): LongArray { - val result = LongArray(size()) + val result = LongArray(size) var index = 0 for (element in this) result[index++] = element @@ -968,7 +968,7 @@ public fun Collection.toLongArray(): LongArray { * Returns an array of Short containing all of the elements of this collection. */ public fun Collection.toShortArray(): ShortArray { - val result = ShortArray(size()) + val result = ShortArray(size) var index = 0 for (element in this) result[index++] = element @@ -1272,7 +1272,7 @@ public inline fun Iterable.any(predicate: (T) -> Boolean): Boolean { * Returns the number of elements in this collection. */ public fun Collection.count(): Int { - return size() + return size } /** @@ -1543,7 +1543,7 @@ public inline fun Iterable.partition(predicate: (T) -> Boolean): Pair Collection.plus(array: Array): List { - val result = ArrayList(this.size() + array.size()) + val result = ArrayList(this.size + array.size) result.addAll(this) result.addAll(array) return result @@ -1565,7 +1565,7 @@ public operator fun Iterable.plus(array: Array): List { */ public operator fun Collection.plus(collection: Iterable): List { if (collection is Collection) { - val result = ArrayList(this.size() + collection.size()) + val result = ArrayList(this.size + collection.size) result.addAll(this) result.addAll(collection) return result @@ -1591,7 +1591,7 @@ public operator fun Iterable.plus(collection: Iterable): List { * Returns a list containing all elements of the original collection and then the given [element]. */ public operator fun Collection.plus(element: T): List { - val result = ArrayList(size() + 1) + val result = ArrayList(size + 1) result.addAll(this) result.add(element) return result @@ -1612,7 +1612,7 @@ public operator fun Iterable.plus(element: T): List { * Returns a list containing all elements of the original collection and then all elements of the given [sequence]. */ public operator fun Collection.plus(sequence: Sequence): List { - val result = ArrayList(this.size() + 10) + val result = ArrayList(this.size + 10) result.addAll(this) result.addAll(sequence) return result @@ -1639,7 +1639,7 @@ public fun Iterable.zip(array: Array): List> { * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. */ public inline fun Iterable.zip(array: Array, transform: (T, R) -> V): List { - val arraySize = array.size() + val arraySize = array.size val list = ArrayList(Math.min(collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in this) { diff --git a/libraries/stdlib/src/generated/_Maps.kt b/libraries/stdlib/src/generated/_Maps.kt index 3e7c8680731..38596846b8e 100644 --- a/libraries/stdlib/src/generated/_Maps.kt +++ b/libraries/stdlib/src/generated/_Maps.kt @@ -16,7 +16,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col * Returns a [List] containing all key-value pairs. */ public fun Map.toList(): List> { - val result = ArrayList>(size()) + val result = ArrayList>(size) for (item in this) result.add(item.key to item.value) return result @@ -45,7 +45,7 @@ public inline fun > Map.flatMapTo(des * to each entry in the original map. */ public inline fun Map.map(transform: (Map.Entry) -> R): List { - return mapTo(ArrayList(size()), transform) + return mapTo(ArrayList(size), transform) } /** @@ -115,7 +115,7 @@ public inline fun Map.any(predicate: (Map.Entry) -> Boolean): * Returns the number of entrys in this map. */ public fun Map.count(): Int { - return size() + return size } /** diff --git a/libraries/stdlib/src/generated/_Sets.kt b/libraries/stdlib/src/generated/_Sets.kt index f44659d3d92..5bd60cb49b3 100644 --- a/libraries/stdlib/src/generated/_Sets.kt +++ b/libraries/stdlib/src/generated/_Sets.kt @@ -39,7 +39,7 @@ public operator fun Set.minus(collection: Iterable): Set { * Returns a set containing all elements of the original set except the given [element]. */ public operator fun Set.minus(element: T): Set { - val result = LinkedHashSet(mapCapacity(size())) + val result = LinkedHashSet(mapCapacity(size)) var removed = false return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true } } @@ -57,7 +57,7 @@ public operator fun Set.minus(sequence: Sequence): Set { * Returns a set containing all elements both of the original set and the given [array]. */ public operator fun Set.plus(array: Array): Set { - val result = LinkedHashSet(mapCapacity(this.size() + array.size())) + val result = LinkedHashSet(mapCapacity(this.size + array.size)) result.addAll(this) result.addAll(array) return result @@ -67,7 +67,7 @@ public operator fun Set.plus(array: Array): Set { * Returns a set containing all elements both of the original set and the given [collection]. */ public operator fun Set.plus(collection: Iterable): Set { - val result = LinkedHashSet(mapCapacity(collection.collectionSizeOrNull()?.let { this.size() + it } ?: this.size() * 2)) + val result = LinkedHashSet(mapCapacity(collection.collectionSizeOrNull()?.let { this.size + it } ?: this.size * 2)) result.addAll(this) result.addAll(collection) return result @@ -77,7 +77,7 @@ public operator fun Set.plus(collection: Iterable): Set { * Returns a set containing all elements of the original set and then the given [element]. */ public operator fun Set.plus(element: T): Set { - val result = LinkedHashSet(mapCapacity(size() + 1)) + val result = LinkedHashSet(mapCapacity(size + 1)) result.addAll(this) result.add(element) return result @@ -87,7 +87,7 @@ public operator fun Set.plus(element: T): Set { * Returns a set containing all elements both of the original set and the given [sequence]. */ public operator fun Set.plus(sequence: Sequence): Set { - val result = LinkedHashSet(mapCapacity(this.size() * 2)) + val result = LinkedHashSet(mapCapacity(this.size * 2)) result.addAll(this) result.addAll(sequence) return result diff --git a/libraries/stdlib/src/generated/_Strings.kt b/libraries/stdlib/src/generated/_Strings.kt index f83a9bf1451..97f59a8e0cc 100644 --- a/libraries/stdlib/src/generated/_Strings.kt +++ b/libraries/stdlib/src/generated/_Strings.kt @@ -289,7 +289,7 @@ public inline fun String.last(predicate: (Char) -> Boolean): Char { * Returns the last character, or `null` if the char sequence is empty. */ public fun CharSequence.lastOrNull(): Char? { - return if (isEmpty()) null else this[length() - 1] + return if (isEmpty()) null else this[length - 1] } /** @@ -297,7 +297,7 @@ public fun CharSequence.lastOrNull(): Char? { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.lastOrNull(): Char? { - return if (isEmpty()) null else this[length() - 1] + return if (isEmpty()) null else this[length - 1] } /** @@ -327,7 +327,7 @@ public inline fun String.lastOrNull(predicate: (Char) -> Boolean): Char? { * Returns the single character, or throws an exception if the char sequence is empty or has more than one character. */ public fun CharSequence.single(): Char { - return when (length()) { + return when (length) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -339,7 +339,7 @@ public fun CharSequence.single(): Char { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.single(): Char { - return when (length()) { + return when (length) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -385,7 +385,7 @@ public inline fun String.single(predicate: (Char) -> Boolean): Char { * Returns single character, or `null` if the char sequence is empty or has more than one character. */ public fun CharSequence.singleOrNull(): Char? { - return if (length() == 1) this[0] else null + return if (length == 1) this[0] else null } /** @@ -393,7 +393,7 @@ public fun CharSequence.singleOrNull(): Char? { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.singleOrNull(): Char? { - return if (length() == 1) this[0] else null + return if (length == 1) this[0] else null } /** @@ -576,7 +576,7 @@ public inline fun String.filterNotTo(destination: C, predicate: * Appends all characters matching the given [predicate] to the given [destination]. */ public inline fun CharSequence.filterTo(destination: C, predicate: (Char) -> Boolean): C { - for (index in 0..length() - 1) { + for (index in 0..length - 1) { val element = get(index) if (predicate(element)) destination.append(element) } @@ -588,7 +588,7 @@ public inline fun CharSequence.filterTo(destination: C, predica */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.filterTo(destination: C, predicate: (Char) -> Boolean): C { - for (index in 0..length() - 1) { + for (index in 0..length - 1) { val element = get(index) if (predicate(element)) destination.append(element) } @@ -735,7 +735,7 @@ public fun String.reversed(): String { * Returns an [ArrayList] of all characters. */ public fun CharSequence.toArrayList(): ArrayList { - return toCollection(ArrayList(length())) + return toCollection(ArrayList(length)) } /** @@ -743,7 +743,7 @@ public fun CharSequence.toArrayList(): ArrayList { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toArrayList(): ArrayList { - return toCollection(ArrayList(length())) + return toCollection(ArrayList(length)) } /** @@ -771,7 +771,7 @@ public fun > String.toCollection(collection: C): * Returns a [HashSet] of all characters. */ public fun CharSequence.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(length()))) + return toCollection(HashSet(mapCapacity(length))) } /** @@ -779,7 +779,7 @@ public fun CharSequence.toHashSet(): HashSet { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toHashSet(): HashSet { - return toCollection(HashSet(mapCapacity(length()))) + return toCollection(HashSet(mapCapacity(length))) } /** @@ -820,7 +820,7 @@ public inline fun String.toMap(selector: (Char) -> K): Map { * If any two characters would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharSequence.toMap(selector: (Char) -> K, transform: (Char) -> V): Map { - val capacity = (length()/.75f) + 1 + val capacity = (length/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -834,7 +834,7 @@ public inline fun CharSequence.toMap(selector: (Char) -> K, transform: (C */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.toMap(selector: (Char) -> K, transform: (Char) -> V): Map { - val capacity = (length()/.75f) + 1 + val capacity = (length/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -848,7 +848,7 @@ public inline fun String.toMap(selector: (Char) -> K, transform: (Char) - * If any two characters would have the same key returned by [selector] the last one gets added to the map. */ public inline fun CharSequence.toMapBy(selector: (Char) -> K): Map { - val capacity = (length()/.75f) + 1 + val capacity = (length/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -863,7 +863,7 @@ public inline fun CharSequence.toMapBy(selector: (Char) -> K): Map */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.toMapBy(selector: (Char) -> K): Map { - val capacity = (length()/.75f) + 1 + val capacity = (length/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -875,7 +875,7 @@ public inline fun String.toMapBy(selector: (Char) -> K): Map { * Returns a [Set] of all characters. */ public fun CharSequence.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(length()))) + return toCollection(LinkedHashSet(mapCapacity(length))) } /** @@ -883,7 +883,7 @@ public fun CharSequence.toSet(): Set { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.toSet(): Set { - return toCollection(LinkedHashSet(mapCapacity(length()))) + return toCollection(LinkedHashSet(mapCapacity(length))) } /** @@ -984,7 +984,7 @@ public inline fun String.groupByTo(map: MutableMap>, to * to each character in the original char sequence. */ public inline fun CharSequence.map(transform: (Char) -> R): List { - return mapTo(ArrayList(length()), transform) + return mapTo(ArrayList(length), transform) } /** @@ -993,7 +993,7 @@ public inline fun CharSequence.map(transform: (Char) -> R): List { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.map(transform: (Char) -> R): List { - return mapTo(ArrayList(length()), transform) + return mapTo(ArrayList(length), transform) } /** @@ -1001,7 +1001,7 @@ public inline fun String.map(transform: (Char) -> R): List { * to each character and its index in the original char sequence. */ public inline fun CharSequence.mapIndexed(transform: (Int, Char) -> R): List { - return mapIndexedTo(ArrayList(length()), transform) + return mapIndexedTo(ArrayList(length), transform) } /** @@ -1010,7 +1010,7 @@ public inline fun CharSequence.mapIndexed(transform: (Int, Char) -> R): List */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.mapIndexed(transform: (Int, Char) -> R): List { - return mapIndexedTo(ArrayList(length()), transform) + return mapIndexedTo(ArrayList(length), transform) } /** @@ -1161,7 +1161,7 @@ public inline fun String.any(predicate: (Char) -> Boolean): Boolean { * Returns the length of this char sequence. */ public fun CharSequence.count(): Int { - return length() + return length } /** @@ -1169,7 +1169,7 @@ public fun CharSequence.count(): Int { */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public fun String.count(): Int { - return length() + return length } /** @@ -1584,7 +1584,7 @@ public fun String.zip(other: String): List> { * Returns a list of values built from characters of both char sequences with same indexes using provided [transform]. List has length of shortest char sequence. */ public inline fun CharSequence.zip(other: String, transform: (Char, Char) -> V): List { - val length = Math.min(this.length(), other.length()) + val length = Math.min(this.length, other.length) val list = ArrayList(length) for (i in 0..length-1) { list.add(transform(this[i], other[i])) @@ -1597,7 +1597,7 @@ public inline fun CharSequence.zip(other: String, transform: (Char, Char) -> */ @Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) public inline fun String.zip(other: String, transform: (Char, Char) -> V): List { - val length = Math.min(this.length(), other.length()) + val length = Math.min(this.length, other.length) val list = ArrayList(length) for (i in 0..length-1) { list.add(transform(this[i], other[i])) diff --git a/libraries/stdlib/src/kotlin/collections/Arrays.kt b/libraries/stdlib/src/kotlin/collections/Arrays.kt index da9bdffe081..e2bd6913b5a 100644 --- a/libraries/stdlib/src/kotlin/collections/Arrays.kt +++ b/libraries/stdlib/src/kotlin/collections/Arrays.kt @@ -29,7 +29,7 @@ public inline fun emptyArray(): Array = arrayOfNulls(0) as Arr * Returns a single list of all elements from all arrays in the given array. */ public fun Array>.flatten(): List { - val result = ArrayList(sumBy { it.size() }) + val result = ArrayList(sumBy { it.size }) for (element in this) { result.addAll(element) } @@ -42,8 +42,8 @@ public fun Array>.flatten(): List { * *second* list is built from the second values of each pair from this array. */ public fun Array>.unzip(): Pair, List> { - val listT = ArrayList(size()) - val listR = ArrayList(size()) + val listT = ArrayList(size) + val listR = ArrayList(size) for (pair in this) { listT.add(pair.first) listR.add(pair.second) diff --git a/libraries/stdlib/src/kotlin/collections/JUtil.kt b/libraries/stdlib/src/kotlin/collections/JUtil.kt index 947a1aff135..71fb9dd7e28 100644 --- a/libraries/stdlib/src/kotlin/collections/JUtil.kt +++ b/libraries/stdlib/src/kotlin/collections/JUtil.kt @@ -47,7 +47,7 @@ internal object EmptyList : List, Serializable { internal fun Array.asCollection(): Collection = ArrayAsCollection(this) private class ArrayAsCollection(val values: Array): Collection { - override val size: Int get() = values.size() + override val size: Int get() = values.size override fun isEmpty(): Boolean = values.isEmpty() override fun contains(o: T): Boolean = values.contains(o) override fun containsAll(c: Collection): Boolean = c.all { contains(it) } @@ -60,7 +60,7 @@ private class ArrayAsCollection(val values: Array): Collection { public fun emptyList(): List = EmptyList /** Returns a new read-only list of given elements. The returned list is serializable (JVM). */ -public fun listOf(vararg values: T): List = if (values.size() > 0) values.asList() else emptyList() +public fun listOf(vararg values: T): List = if (values.size > 0) values.asList() else emptyList() /** Returns an empty read-only list. The returned list is serializable (JVM). */ public fun listOf(): List = emptyList() @@ -75,11 +75,11 @@ public fun listOf(value: T): List = Collections.singletonList(value) /** Returns a new [LinkedList] with the given elements. */ @JvmVersion public fun linkedListOf(vararg values: T): LinkedList - = if (values.size() == 0) LinkedList() else LinkedList(ArrayAsCollection(values)) + = if (values.size == 0) LinkedList() else LinkedList(ArrayAsCollection(values)) /** Returns a new [ArrayList] with the given elements. */ public fun arrayListOf(vararg values: T): ArrayList - = if (values.size() == 0) ArrayList() else ArrayList(ArrayAsCollection(values)) + = if (values.size == 0) ArrayList() else ArrayList(ArrayAsCollection(values)) /** Returns a new read-only list either of single given element, if it is not null, or empty list it the element is null. The returned list is serializable (JVM). */ public fun listOfNotNull(value: T?): List = if (value != null) listOf(value) else emptyList() @@ -91,7 +91,7 @@ public fun listOfNotNull(vararg values: T?): List = values.filterNo * Returns an [IntRange] of the valid indices for this collection. */ public val Collection<*>.indices: IntRange - get() = 0..size() - 1 + get() = 0..size - 1 /** * Returns the index of the last item in the list or -1 if the list is empty. @@ -99,7 +99,7 @@ public val Collection<*>.indices: IntRange * @sample test.collections.ListSpecificTest.lastIndex */ public val List.lastIndex: Int - get() = this.size() - 1 + get() = this.size - 1 /** Returns `true` if the collection is not empty. */ public fun Collection.isNotEmpty(): Boolean = !isEmpty() @@ -120,15 +120,15 @@ public fun Enumeration.toList(): List = Collections.list(this) /** * Returns the size of this iterable if it is known, or `null` otherwise. */ -public fun Iterable.collectionSizeOrNull(): Int? = if (this is Collection<*>) size() else null +public fun Iterable.collectionSizeOrNull(): Int? = if (this is Collection<*>) this.size else null /** * Returns the size of this iterable if it is known, or the specified [default] value otherwise. */ -public fun Iterable.collectionSizeOrDefault(default: Int): Int = if (this is Collection<*>) size() else default +public fun Iterable.collectionSizeOrDefault(default: Int): Int = if (this is Collection<*>) this.size else default /** Returns true when it's safe to convert this collection to a set without changing contains method behavior. */ -private fun Collection.safeToConvertToSet() = size() > 2 && this is ArrayList +private fun Collection.safeToConvertToSet() = size > 2 && this is ArrayList /** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */ internal fun Iterable.convertToSetForSetOperationWith(source: Iterable): Collection = @@ -136,7 +136,7 @@ internal fun Iterable.convertToSetForSetOperationWith(source: Iterable is Set -> this is Collection -> when { - source is Collection && source.size() < 2 -> this + source is Collection && source.size < 2 -> this else -> if (this.safeToConvertToSet()) toHashSet() else this } else -> toHashSet() @@ -153,7 +153,7 @@ internal fun Iterable.convertToSetForSetOperation(): Collection = // copies typed varargs array to array of objects @JvmVersion private fun Array.varargToArrayOfAny(): Array - = Arrays.copyOf(this, this.size(), Array::class.java) + = Arrays.copyOf(this, this.size, Array::class.java) /** * Searches this list or its range for the provided [element] index using binary search algorithm. @@ -161,8 +161,8 @@ private fun Array.varargToArrayOfAny(): Array * * If the list contains multiple elements equal to the specified object, there is no guarantee which one will be found. */ -public fun > List.binarySearch(element: T?, fromIndex: Int = 0, toIndex: Int = size()): Int { - rangeCheck(size(), fromIndex, toIndex) +public fun > List.binarySearch(element: T?, fromIndex: Int = 0, toIndex: Int = size): Int { + rangeCheck(size, fromIndex, toIndex) var low = fromIndex var high = toIndex - 1 @@ -188,8 +188,8 @@ public fun > List.binarySearch(element: T?, fromIndex: Int * * If the list contains multiple elements equal to the specified object, there is no guarantee which one will be found. */ -public fun List.binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size()): Int { - rangeCheck(size(), fromIndex, toIndex) +public fun List.binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Int { + rangeCheck(size, fromIndex, toIndex) var low = fromIndex var high = toIndex - 1 @@ -215,7 +215,7 @@ public fun List.binarySearch(element: T, comparator: Comparator, fr * * If the list contains multiple elements with the specified [key], there is no guarantee which one will be found. */ -public inline fun > List.binarySearchBy(key: K?, fromIndex: Int = 0, toIndex: Int = size(), crossinline selector: (T) -> K?): Int = +public inline fun > List.binarySearchBy(key: K?, fromIndex: Int = 0, toIndex: Int = size, crossinline selector: (T) -> K?): Int = binarySearch(fromIndex, toIndex) { compareValues(selector(it), key) } // do not introduce this overload --- too rare @@ -228,8 +228,8 @@ public inline fun > List.binarySearchBy(key: K?, fromInd * * @param comparison function that compares an element of the list with the element being searched. */ -public fun List.binarySearch(fromIndex: Int = 0, toIndex: Int = size(), comparison: (T) -> Int): Int { - rangeCheck(size(), fromIndex, toIndex) +public fun List.binarySearch(fromIndex: Int = 0, toIndex: Int = size, comparison: (T) -> Int): Int { + rangeCheck(size, fromIndex, toIndex) var low = fromIndex var high = toIndex - 1 diff --git a/libraries/stdlib/src/kotlin/collections/MapWithDefault.kt b/libraries/stdlib/src/kotlin/collections/MapWithDefault.kt index b40e3dbf48c..5c4f97f5a36 100644 --- a/libraries/stdlib/src/kotlin/collections/MapWithDefault.kt +++ b/libraries/stdlib/src/kotlin/collections/MapWithDefault.kt @@ -64,7 +64,7 @@ private class MapWithDefaultImpl(public override val map: Map, pr override fun equals(other: Any?): Boolean = map.equals(other) override fun hashCode(): Int = map.hashCode() override fun toString(): String = map.toString() - override val size: Int get() = map.size() + override val size: Int get() = map.size override fun isEmpty(): Boolean = map.isEmpty() override fun containsKey(key: K): Boolean = map.containsKey(key) override fun containsValue(value: @UnsafeVariance V): Boolean = map.containsValue(value) @@ -80,7 +80,7 @@ private class MutableMapWithDefaultImpl(public override val map: MutableMa override fun equals(other: Any?): Boolean = map.equals(other) override fun hashCode(): Int = map.hashCode() override fun toString(): String = map.toString() - override val size: Int get() = map.size() + override val size: Int get() = map.size override fun isEmpty(): Boolean = map.isEmpty() override fun containsKey(key: K): Boolean = map.containsKey(key) override fun containsValue(value: @UnsafeVariance V): Boolean = map.containsValue(value) diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index c451333093e..1e85f0619a4 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -34,7 +34,7 @@ public fun emptyMap(): Map = EmptyMap as Map * * The returned map is serializable (JVM). */ -public fun mapOf(vararg values: Pair): Map = if (values.size() > 0) linkedMapOf(*values) else emptyMap() +public fun mapOf(vararg values: Pair): Map = if (values.size > 0) linkedMapOf(*values) else emptyMap() /** Returns an empty read-only map. The returned map is serializable (JVM). */ public fun mapOf(): Map = emptyMap() @@ -53,7 +53,7 @@ public fun mapOf(keyValuePair: Pair): Map = Collections.singl * @sample test.collections.MapTest.createUsingPairs */ public fun hashMapOf(vararg values: Pair): HashMap { - val answer = HashMap(mapCapacity(values.size())) + val answer = HashMap(mapCapacity(values.size)) answer.putAll(*values) return answer } @@ -66,7 +66,7 @@ public fun hashMapOf(vararg values: Pair): HashMap { * @sample test.collections.MapTest.createLinkedMap */ public fun linkedMapOf(vararg values: Pair): LinkedHashMap { - val answer = LinkedHashMap(mapCapacity(values.size())) + val answer = LinkedHashMap(mapCapacity(values.size)) answer.putAll(*values) return answer } @@ -350,7 +350,7 @@ public fun Iterable>.toMap(): Map { * Returns a new map containing all key-value pairs from the given array of pairs. */ public fun Array>.toMap(): Map { - val result = LinkedHashMap(mapCapacity(size())) + val result = LinkedHashMap(mapCapacity(size)) for (element in this) { result.put(element.first, element.second) } diff --git a/libraries/stdlib/src/kotlin/collections/ReversedViews.kt b/libraries/stdlib/src/kotlin/collections/ReversedViews.kt index 33d667c3cb7..6c7646ddffb 100644 --- a/libraries/stdlib/src/kotlin/collections/ReversedViews.kt +++ b/libraries/stdlib/src/kotlin/collections/ReversedViews.kt @@ -21,11 +21,11 @@ package kotlin import java.util.AbstractList private open class ReversedListReadOnly(protected open val delegate: List) : AbstractList() { - override val size: Int get() = delegate.size() + override val size: Int get() = delegate.size override fun get(index: Int): T = delegate[index.flipIndex()] - protected fun Int.flipIndex(): Int = if (this in 0..size() - 1) size() - this - 1 else throw IndexOutOfBoundsException("index $this should be in range [${0..size() - 1}]") - protected fun Int.flipIndexForward(): Int = if (this in 0..size()) size() - this else throw IndexOutOfBoundsException("index $this should be in range [${0..size()}]") + protected fun Int.flipIndex(): Int = if (this in 0..size - 1) size - this - 1 else throw IndexOutOfBoundsException("index $this should be in range [${0..size - 1}]") + protected fun Int.flipIndexForward(): Int = if (this in 0..size) size - this else throw IndexOutOfBoundsException("index $this should be in range [${0..size}]") } private class ReversedList(protected override val delegate: MutableList) : ReversedListReadOnly(delegate) { diff --git a/libraries/stdlib/src/kotlin/collections/Sets.kt b/libraries/stdlib/src/kotlin/collections/Sets.kt index 2e5c5c24dc8..1d930145dad 100644 --- a/libraries/stdlib/src/kotlin/collections/Sets.kt +++ b/libraries/stdlib/src/kotlin/collections/Sets.kt @@ -26,17 +26,17 @@ internal object EmptySet : Set, Serializable { /** Returns an empty read-only set. The returned set is serializable (JVM). */ public fun emptySet(): Set = EmptySet /** Returns a new read-only ordered set with the given elements. The returned set is serializable (JVM). */ -public fun setOf(vararg values: T): Set = if (values.size() > 0) values.toSet() else emptySet() +public fun setOf(vararg values: T): Set = if (values.size > 0) values.toSet() else emptySet() /** Returns an empty read-only set. The returned set is serializable (JVM). */ public fun setOf(): Set = emptySet() /** Returns a new [HashSet] with the given elements. */ -public fun hashSetOf(vararg values: T): HashSet = values.toCollection(HashSet(mapCapacity(values.size()))) +public fun hashSetOf(vararg values: T): HashSet = values.toCollection(HashSet(mapCapacity(values.size))) /** Returns a new [LinkedHashSet] with the given elements. */ -public fun linkedSetOf(vararg values: T): LinkedHashSet = values.toCollection(LinkedHashSet(mapCapacity(values.size()))) +public fun linkedSetOf(vararg values: T): LinkedHashSet = values.toCollection(LinkedHashSet(mapCapacity(values.size))) /** Returns this Set if it's not `null` and the empty set otherwise. */ public fun Set?.orEmpty(): Set = this ?: emptySet() diff --git a/libraries/stdlib/src/kotlin/io/files/FilePathComponents.kt b/libraries/stdlib/src/kotlin/io/files/FilePathComponents.kt index 3dce801dff2..c1344b482ec 100644 --- a/libraries/stdlib/src/kotlin/io/files/FilePathComponents.kt +++ b/libraries/stdlib/src/kotlin/io/files/FilePathComponents.kt @@ -23,7 +23,7 @@ private fun String.getRootName(): String { // Note: separators should be already replaced to system ones var first = indexOf(File.separatorChar, 0) if (first == 0) { - if (length() > 1 && this[1] == File.separatorChar) { + if (length > 1 && this[1] == File.separatorChar) { // Network names like //my.host/home/something ? => //my.host/home/ should be root // NB: does not work in Unix because //my.host/home is converted into /my.host/home there // So in Windows we'll have root of //my.host/home but in Unix just / @@ -75,7 +75,7 @@ public val File.rootName: String public val File.root: File? get() { val name = rootName - return if (name.length() > 0) File(name) else null + return if (name.length > 0) File(name) else null } /** @@ -89,7 +89,7 @@ public data class FilePathComponents(public val rootName: String, public val fil /** * Returns the number of elements in the path to the file. */ - public fun size(): Int = fileList.size() + public fun size(): Int = fileList.size /** * Returns a sub-path of the path, starting with the directory at the specified [beginIndex] and up @@ -110,10 +110,10 @@ public data class FilePathComponents(public val rootName: String, public val fil public fun File.filePathComponents(): FilePathComponents { val path = separatorsToSystem() val rootName = path.getRootName() - val subPath = path.substring(rootName.length()) + val subPath = path.substring(rootName.length) // if: a special case when we have only root component // Split not only by / or \, but also by //, ///, \\, \\\, etc. - val list = if (rootName.length() > 0 && subPath.isEmpty()) listOf() else + val list = if (rootName.length > 0 && subPath.isEmpty()) listOf() else // Looks awful but we split just by /+ or \+ depending on OS subPath.split(Regex.fromLiteral(File.separatorChar.toString())).toList().map { it -> File(it) } return FilePathComponents(rootName, list) diff --git a/libraries/stdlib/src/kotlin/io/files/FileTreeWalk.kt b/libraries/stdlib/src/kotlin/io/files/FileTreeWalk.kt index cff3a085080..3c476608f39 100644 --- a/libraries/stdlib/src/kotlin/io/files/FileTreeWalk.kt +++ b/libraries/stdlib/src/kotlin/io/files/FileTreeWalk.kt @@ -77,7 +77,7 @@ public class FileTreeWalk(private val start: File, failed = true } } - if (fileList != null && fileIndex < fileList!!.size()) { + if (fileList != null && fileIndex < fileList!!.size) { // First visit all files return fileList!![fileIndex++] } else if (!rootVisited) { @@ -108,14 +108,14 @@ public class FileTreeWalk(private val start: File, enter(rootDir) rootVisited = true return rootDir - } else if (fileList == null || fileIndex < fileList!!.size()) { + } else if (fileList == null || fileIndex < fileList!!.size) { if (fileList == null) { // Then read an array of files, if any fileList = rootDir.listFiles() if (fileList == null) { fail(rootDir, AccessDeniedException(file = rootDir, reason = "Cannot list files in a directory")) } - if (fileList == null || fileList!!.size() == 0) { + if (fileList == null || fileList!!.size == 0) { leave(rootDir) return null } @@ -175,7 +175,7 @@ public class FileTreeWalk(private val start: File, // Check that file/directory matches the filter if (!filter(file)) return gotoNext() - if (file == topState.rootDir || !file.isDirectory() || state.size() >= maxDepth) { + if (file == topState.rootDir || !file.isDirectory() || state.size >= maxDepth) { // Proceed to a root directory or a simple file return file } else { diff --git a/libraries/stdlib/src/kotlin/io/files/Utils.kt b/libraries/stdlib/src/kotlin/io/files/Utils.kt index a6e1b8aab23..bad0ba29e1f 100644 --- a/libraries/stdlib/src/kotlin/io/files/Utils.kt +++ b/libraries/stdlib/src/kotlin/io/files/Utils.kt @@ -159,8 +159,8 @@ public fun File.relativePath(descendant: File): String { val prefix = directory.canonicalPath val answer = descendant.canonicalPath return if (answer.startsWith(prefix)) { - val prefixSize = prefix.length() - if (answer.length() > prefixSize) { + val prefixSize = prefix.length + if (answer.length > prefixSize) { answer.substring(prefixSize + 1) } else "" } else { @@ -368,7 +368,7 @@ public fun File.normalize(): File { when (name) { "." -> { } - ".." -> if (!list.isEmpty() && list.get(list.size() - 1) != "..") list.remove(list.size() - 1) else list.add(name) + ".." -> if (!list.isEmpty() && list.get(list.size - 1) != "..") list.remove(list.size - 1) else list.add(name) else -> list.add(name) } } diff --git a/libraries/stdlib/src/kotlin/text/Indent.kt b/libraries/stdlib/src/kotlin/text/Indent.kt index c372b653ad2..ba7626e3550 100644 --- a/libraries/stdlib/src/kotlin/text/Indent.kt +++ b/libraries/stdlib/src/kotlin/text/Indent.kt @@ -34,12 +34,12 @@ public fun String.replaceIndentByMargin(newIndent: String = "", marginPrefix: St require(marginPrefix.isNotBlank()) { "marginPrefix should be non blank string but it is '$marginPrefix'" } val lines = lines() - return lines.reindent(length() + newIndent.length() * lines.size(), getIndentFunction(newIndent), { line -> + return lines.reindent(length + newIndent.length * lines.size, getIndentFunction(newIndent), { line -> val firstNonWhitespaceIndex = line.indexOfFirst { !it.isWhitespace() } when { firstNonWhitespaceIndex == -1 -> null - line.startsWith(marginPrefix, firstNonWhitespaceIndex) -> line.substring(firstNonWhitespaceIndex + marginPrefix.length()) + line.startsWith(marginPrefix, firstNonWhitespaceIndex) -> line.substring(firstNonWhitespaceIndex + marginPrefix.length) else -> null } }) @@ -80,7 +80,7 @@ public fun String.replaceIndent(newIndent: String = ""): String { .map { it.indentWidth() } .min() ?: 0 - return lines.reindent(length() + newIndent.length() * lines.size(), getIndentFunction(newIndent), { line -> line.drop(minCommonIndent) }) + return lines.reindent(length + newIndent.length * lines.size, getIndentFunction(newIndent), { line -> line.drop(minCommonIndent) }) } /** @@ -92,7 +92,7 @@ public fun String.prependIndent(indent: String = " "): String = when { it.isBlank() -> { when { - it.length() < indent.length() -> indent + it.length < indent.length -> indent else -> it } } @@ -101,7 +101,7 @@ public fun String.prependIndent(indent: String = " "): String = } .joinToString("\n") -private fun String.indentWidth(): Int = indexOfFirst { !it.isWhitespace() }.let { if (it == -1) length() else it } +private fun String.indentWidth(): Int = indexOfFirst { !it.isWhitespace() }.let { if (it == -1) length else it } private fun getIndentFunction(indent: String) = when { indent.isEmpty() -> { line: String -> line } diff --git a/libraries/stdlib/src/kotlin/text/Strings.kt b/libraries/stdlib/src/kotlin/text/Strings.kt index e733c6ee01d..950954842cb 100644 --- a/libraries/stdlib/src/kotlin/text/Strings.kt +++ b/libraries/stdlib/src/kotlin/text/Strings.kt @@ -13,7 +13,7 @@ import kotlin.text.Regex */ inline public fun CharSequence.trim(predicate: (Char) -> Boolean): CharSequence { var startIndex = 0 - var endIndex = length() - 1 + var endIndex = length - 1 var startFound = false while (startIndex <= endIndex) { @@ -206,17 +206,17 @@ public fun String.padEnd(length: Int, padChar: Char = ' '): String /** * Returns `true` if this nullable char sequence is either `null` or empty. */ -public fun CharSequence?.isNullOrEmpty(): Boolean = this == null || this.length() == 0 +public fun CharSequence?.isNullOrEmpty(): Boolean = this == null || this.length == 0 /** * Returns `true` if this char sequence is empty (contains no characters). */ -public fun CharSequence.isEmpty(): Boolean = length() == 0 +public fun CharSequence.isEmpty(): Boolean = length == 0 /** * Returns `true` if this char sequence is not empty. */ -public fun CharSequence.isNotEmpty(): Boolean = length() > 0 +public fun CharSequence.isNotEmpty(): Boolean = length > 0 // implemented differently in JVM and JS //public fun String.isBlank(): Boolean = length() == 0 || all { it.isWhitespace() } @@ -240,7 +240,7 @@ public operator fun CharSequence.iterator(): CharIterator = object : CharIterato public override fun nextChar(): Char = get(index++) - public override fun hasNext(): Boolean = index < length() + public override fun hasNext(): Boolean = index < length } /** Returns the string if it is not `null`, or the empty string otherwise. */ @@ -250,13 +250,13 @@ public fun String?.orEmpty(): String = this ?: "" * Returns the range of valid character indices for this char sequence. */ public val CharSequence.indices: IntRange - get() = 0..length() - 1 + get() = 0..length - 1 /** * Returns the index of the last character in the char sequence or -1 if it is empty. */ public val CharSequence.lastIndex: Int - get() = this.length() - 1 + get() = this.length - 1 /** * Returns a character at the given index in a [CharSequence]. Allows to use the @@ -271,7 +271,7 @@ public operator fun CharSequence.get(index: Int): Char = this.get(index) * Returns `true` if this CharSequence has Unicode surrogate pair at the specified [index]. */ public fun CharSequence.hasSurrogatePairAt(index: Int): Boolean { - return index in 0..length() - 2 + return index in 0..length - 2 && this[index].isHighSurrogate() && this[index + 1].isLowSurrogate() } @@ -320,7 +320,7 @@ public fun String.substringBefore(delimiter: String, missingDelimiterValue: Stri */ public fun String.substringAfter(delimiter: Char, missingDelimiterValue: String = this): String { val index = indexOf(delimiter) - return if (index == -1) missingDelimiterValue else substring(index + 1, length()) + return if (index == -1) missingDelimiterValue else substring(index + 1, length) } /** @@ -329,7 +329,7 @@ public fun String.substringAfter(delimiter: Char, missingDelimiterValue: String */ public fun String.substringAfter(delimiter: String, missingDelimiterValue: String = this): String { val index = indexOf(delimiter) - return if (index == -1) missingDelimiterValue else substring(index + delimiter.length(), length()) + return if (index == -1) missingDelimiterValue else substring(index + delimiter.length, length) } /** @@ -356,7 +356,7 @@ public fun String.substringBeforeLast(delimiter: String, missingDelimiterValue: */ public fun String.substringAfterLast(delimiter: Char, missingDelimiterValue: String = this): String { val index = lastIndexOf(delimiter) - return if (index == -1) missingDelimiterValue else substring(index + 1, length()) + return if (index == -1) missingDelimiterValue else substring(index + 1, length) } /** @@ -365,7 +365,7 @@ public fun String.substringAfterLast(delimiter: Char, missingDelimiterValue: Str */ public fun String.substringAfterLast(delimiter: String, missingDelimiterValue: String = this): String { val index = lastIndexOf(delimiter) - return if (index == -1) missingDelimiterValue else substring(index + delimiter.length(), length()) + return if (index == -1) missingDelimiterValue else substring(index + delimiter.length, length) } /** @@ -380,7 +380,7 @@ public fun CharSequence.replaceRange(firstIndex: Int, lastIndex: Int, replacemen val sb = StringBuilder() sb.append(this, 0, firstIndex) sb.append(replacement) - sb.append(this, lastIndex, length()) + sb.append(this, lastIndex, length) return sb } @@ -424,9 +424,9 @@ public fun CharSequence.removeRange(firstIndex: Int, lastIndex: Int): CharSequen if (lastIndex == firstIndex) return this.subSequence(0, length) - val sb = StringBuilder(length() - (lastIndex - firstIndex)) + val sb = StringBuilder(length - (lastIndex - firstIndex)) sb.append(this, 0, firstIndex) - sb.append(this, lastIndex, length()) + sb.append(this, lastIndex, length) return sb } @@ -560,7 +560,7 @@ public fun String.replaceBefore(delimiter: String, replacement: String, missingD */ public fun String.replaceAfter(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String { val index = indexOf(delimiter) - return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length(), replacement) + return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length, replacement) } /** @@ -569,7 +569,7 @@ public fun String.replaceAfter(delimiter: Char, replacement: String, missingDeli */ public fun String.replaceAfter(delimiter: String, replacement: String, missingDelimiterValue: String = this): String { val index = indexOf(delimiter) - return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length(), length(), replacement) + return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length, length, replacement) } /** @@ -578,7 +578,7 @@ public fun String.replaceAfter(delimiter: String, replacement: String, missingDe */ public fun String.replaceAfterLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String { val index = lastIndexOf(delimiter) - return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length(), length(), replacement) + return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length, length, replacement) } /** @@ -587,7 +587,7 @@ public fun String.replaceAfterLast(delimiter: String, replacement: String, missi */ public fun String.replaceAfterLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String { val index = lastIndexOf(delimiter) - return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length(), replacement) + return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length, replacement) } /** @@ -662,13 +662,13 @@ internal fun CharSequence.regionMatchesImpl(thisOffset: Int, other: CharSequence * Returns `true` if this char sequence starts with the specified character. */ public fun CharSequence.startsWith(char: Char, ignoreCase: Boolean = false): Boolean = - this.length() > 0 && this[0].equals(char, ignoreCase) + this.length > 0 && this[0].equals(char, ignoreCase) /** * Returns `true` if this char sequence ends with the specified character. */ public fun CharSequence.endsWith(char: Char, ignoreCase: Boolean = false): Boolean = - this.length() > 0 && this[lastIndex].equals(char, ignoreCase) + this.length > 0 && this[lastIndex].equals(char, ignoreCase) /** * Returns `true` if this char sequence starts with the specified prefix. @@ -677,7 +677,7 @@ public fun CharSequence.startsWith(prefix: CharSequence, ignoreCase: Boolean = f if (!ignoreCase && this is String && prefix is String) return this.startsWith(prefix) else - return regionMatchesImpl(0, prefix, 0, prefix.length(), ignoreCase) + return regionMatchesImpl(0, prefix, 0, prefix.length, ignoreCase) } /** @@ -687,7 +687,7 @@ public fun CharSequence.startsWith(prefix: CharSequence, thisOffset: Int, ignore if (!ignoreCase && this is String && prefix is String) return this.startsWith(prefix, thisOffset) else - return regionMatchesImpl(thisOffset, prefix, 0, prefix.length(), ignoreCase) + return regionMatchesImpl(thisOffset, prefix, 0, prefix.length, ignoreCase) } /** @@ -697,7 +697,7 @@ public fun CharSequence.endsWith(suffix: CharSequence, ignoreCase: Boolean = fal if (!ignoreCase && this is String && suffix is String) return this.endsWith(suffix) else - return regionMatchesImpl(length() - suffix.length(), suffix, 0, suffix.length(), ignoreCase) + return regionMatchesImpl(length - suffix.length, suffix, 0, suffix.length, ignoreCase) } @@ -711,7 +711,7 @@ public fun CharSequence.endsWith(suffix: CharSequence, ignoreCase: Boolean = fal * @param ignoreCase `true` to ignore character case when matching a character. By default `false`. */ public fun CharSequence.commonPrefixWith(other: CharSequence, ignoreCase: Boolean = false): String { - val shortestLength = Math.min(this.length(), other.length()) + val shortestLength = Math.min(this.length, other.length) var i = 0 while (i < shortestLength && this[i].equals(other[i], ignoreCase = ignoreCase)) { @@ -731,8 +731,8 @@ public fun CharSequence.commonPrefixWith(other: CharSequence, ignoreCase: Boolea * @param ignoreCase `true` to ignore character case when matching a character. By default `false`. */ public fun CharSequence.commonSuffixWith(other: CharSequence, ignoreCase: Boolean = false): String { - val thisLength = this.length() - val otherLength = other.length() + val thisLength = this.length + val otherLength = other.length val shortestLength = Math.min(thisLength, otherLength) var i = 0 @@ -749,7 +749,7 @@ public fun CharSequence.commonSuffixWith(other: CharSequence, ignoreCase: Boolea // indexOfAny() private fun CharSequence.findAnyOf(chars: CharArray, startIndex: Int, ignoreCase: Boolean, last: Boolean): Pair? { - if (!ignoreCase && chars.size() == 1 && this is String) { + if (!ignoreCase && chars.size == 1 && this is String) { val char = chars.single() val index = if (!last) nativeIndexOf(char, startIndex) else nativeLastIndexOf(char, startIndex) return if (index < 0) null else index to char @@ -792,18 +792,18 @@ public fun CharSequence.lastIndexOfAny(chars: CharArray, startIndex: Int = lastI private fun CharSequence.indexOf(other: CharSequence, startIndex: Int, endIndex: Int, ignoreCase: Boolean, last: Boolean = false): Int { val indices = if (!last) - startIndex.coerceAtLeast(0)..endIndex.coerceAtMost(length()) + startIndex.coerceAtLeast(0)..endIndex.coerceAtMost(length) else startIndex.coerceAtMost(lastIndex) downTo endIndex.coerceAtLeast(0) if (this is String && other is String) { // smart cast for (index in indices) { - if (other.regionMatches(0, this, index, other.length(), ignoreCase)) + if (other.regionMatches(0, this, index, other.length, ignoreCase)) return index } } else { for (index in indices) { - if (other.regionMatchesImpl(0, this, index, other.length(), ignoreCase)) + if (other.regionMatchesImpl(0, this, index, other.length, ignoreCase)) return index } } @@ -817,17 +817,17 @@ private fun CharSequence.findAnyOf(strings: Collection, startIndex: Int, return if (index < 0) null else index to string } - val indices = if (!last) startIndex.coerceAtLeast(0)..length() else startIndex.coerceAtMost(lastIndex) downTo 0 + val indices = if (!last) startIndex.coerceAtLeast(0)..length else startIndex.coerceAtMost(lastIndex) downTo 0 if (this is String) { for (index in indices) { - val matchingString = strings.firstOrNull { it.regionMatches(0, this, index, it.length(), ignoreCase) } + val matchingString = strings.firstOrNull { it.regionMatches(0, this, index, it.length, ignoreCase) } if (matchingString != null) return index to matchingString } } else { for (index in indices) { - val matchingString = strings.firstOrNull { it.regionMatchesImpl(0, this, index, it.length(), ignoreCase) } + val matchingString = strings.firstOrNull { it.regionMatchesImpl(0, this, index, it.length, ignoreCase) } if (matchingString != null) return index to matchingString } @@ -920,7 +920,7 @@ public fun CharSequence.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boo */ public fun CharSequence.indexOf(string: String, startIndex: Int = 0, ignoreCase: Boolean = false): Int { return if (ignoreCase || this !is String) - indexOf(string, startIndex, length(), ignoreCase) + indexOf(string, startIndex, length, ignoreCase) else nativeIndexOf(string, startIndex) } @@ -964,7 +964,7 @@ public operator fun CharSequence.contains(other: CharSequence, ignoreCase: Boole if (other is String) indexOf(other, ignoreCase = ignoreCase) >= 0 else - indexOf(other, 0, length(), ignoreCase) >= 0 + indexOf(other, 0, length, ignoreCase) >= 0 @@ -989,7 +989,7 @@ private class DelimitedRangesSequence(private val input: CharSequence, private v override fun iterator(): Iterator = object : Iterator { var nextState: Int = -1 // -1 for unknown, 0 for done, 1 for continue - var currentStartIndex: Int = Math.min(Math.max(startIndex, 0), input.length()) + var currentStartIndex: Int = Math.min(Math.max(startIndex, 0), input.length) var nextSearchIndex: Int = currentStartIndex var nextItem: IntRange? = null var counter: Int = 0 @@ -1000,7 +1000,7 @@ private class DelimitedRangesSequence(private val input: CharSequence, private v nextItem = null } else { - if (limit > 0 && ++counter >= limit || nextSearchIndex > input.length()) { + if (limit > 0 && ++counter >= limit || nextSearchIndex > input.length) { nextItem = currentStartIndex..input.lastIndex nextSearchIndex = -1 } @@ -1076,7 +1076,7 @@ private fun CharSequence.rangesDelimitedBy(delimiters: Array, startI require(limit >= 0, { "Limit must be non-negative, but was $limit" } ) val delimitersList = delimiters.asList() - return DelimitedRangesSequence(this, startIndex, limit, { startIndex -> findAnyOf(delimitersList, startIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length ()} }) + return DelimitedRangesSequence(this, startIndex, limit, { startIndex -> findAnyOf(delimitersList, startIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length } }) } diff --git a/libraries/stdlib/src/kotlin/text/StringsJVM.kt b/libraries/stdlib/src/kotlin/text/StringsJVM.kt index 492d44d9061..ea88ad55d12 100644 --- a/libraries/stdlib/src/kotlin/text/StringsJVM.kt +++ b/libraries/stdlib/src/kotlin/text/StringsJVM.kt @@ -75,7 +75,7 @@ public fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean */ public fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String { val index = indexOf(oldValue, ignoreCase = ignoreCase) - return if (index < 0) this else this.replaceRange(index, index + oldValue.length(), newValue) + return if (index < 0) this else this.replaceRange(index, index + oldValue.length, newValue) } /** @@ -134,7 +134,7 @@ public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boole if (!ignoreCase) return (this as java.lang.String).startsWith(prefix) else - return regionMatches(0, prefix, 0, prefix.length(), ignoreCase) + return regionMatches(0, prefix, 0, prefix.length, ignoreCase) } /** @@ -144,7 +144,7 @@ public fun String.startsWith(prefix: String, thisOffset: Int, ignoreCase: Boolea if (!ignoreCase) return (this as java.lang.String).startsWith(prefix, thisOffset) else - return regionMatches(thisOffset, prefix, 0, prefix.length(), ignoreCase) + return regionMatches(thisOffset, prefix, 0, prefix.length, ignoreCase) } /** @@ -154,7 +154,7 @@ public fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean if (!ignoreCase) return (this as java.lang.String).endsWith(suffix) else - return regionMatches(length() - suffix.length(), suffix, 0, suffix.length(), ignoreCase = true) + return regionMatches(length - suffix.length, suffix, 0, suffix.length, ignoreCase = true) } // "constructors" for String @@ -292,7 +292,7 @@ public fun String.intern(): String = (this as java.lang.String).intern() /** * Returns `true` if this string is empty or consists solely of whitespace characters. */ -public fun CharSequence.isBlank(): Boolean = length() == 0 || indices.all { this[it].isWhitespace() } +public fun CharSequence.isBlank(): Boolean = length == 0 || indices.all { this[it].isWhitespace() } /** * Returns the index within this string that is offset from the given [index] by [codePointOffset] code points. @@ -440,7 +440,7 @@ public fun CharSequence.repeat(n: Int): String { if (n < 0) throw IllegalArgumentException("Value should be non-negative, but was $n") - val sb = StringBuilder(n * length()) + val sb = StringBuilder(n * length) for (i in 1..n) { sb.append(this) } diff --git a/libraries/stdlib/src/kotlin/text/regex/RegexJVM.kt b/libraries/stdlib/src/kotlin/text/regex/RegexJVM.kt index bb886c17afd..97f5679c13d 100644 --- a/libraries/stdlib/src/kotlin/text/regex/RegexJVM.kt +++ b/libraries/stdlib/src/kotlin/text/regex/RegexJVM.kt @@ -162,7 +162,7 @@ public class Regex internal constructor(private val nativePattern: Pattern) { var match: MatchResult? = find(input) ?: return input.toString() var lastStart = 0 - val length = input.length() + val length = input.length val sb = StringBuilder(length) do { val foundMatch = match!! @@ -256,7 +256,7 @@ private class MatcherMatchResult(private val matcher: Matcher, private val input override fun next(): MatchResult? { val nextIndex = matchResult.end() + if (matchResult.end() == matchResult.start()) 1 else 0 - return if (nextIndex <= input.length()) matcher.findNext(nextIndex, input) else null + return if (nextIndex <= input.length) matcher.findNext(nextIndex, input) else null } } diff --git a/libraries/stdlib/src/kotlin/util/Ordering.kt b/libraries/stdlib/src/kotlin/util/Ordering.kt index 459532b7d8e..272cd7344fa 100644 --- a/libraries/stdlib/src/kotlin/util/Ordering.kt +++ b/libraries/stdlib/src/kotlin/util/Ordering.kt @@ -26,7 +26,7 @@ import java.util.Comparator * compare as equal, the result of that comparison is returned. */ public fun compareValuesBy(a: T, b: T, vararg selectors: (T) -> Comparable<*>?): Int { - require(selectors.size() > 0) + require(selectors.size > 0) for (fn in selectors) { val v1 = fn(a) val v2 = fn(b) diff --git a/libraries/stdlib/test/ExceptionTest.kt b/libraries/stdlib/test/ExceptionTest.kt index a0c15590988..46348c65aa8 100644 --- a/libraries/stdlib/test/ExceptionTest.kt +++ b/libraries/stdlib/test/ExceptionTest.kt @@ -39,6 +39,6 @@ class ExceptionTest { } val bytes = assertNotNull(byteBuffer.toByteArray()) - assertTrue(bytes.size() > 10) + assertTrue(bytes.size > 10) } } diff --git a/libraries/stdlib/test/OldStdlibTest.kt b/libraries/stdlib/test/OldStdlibTest.kt index c38b64c78c2..0b0ca9f9f0c 100644 --- a/libraries/stdlib/test/OldStdlibTest.kt +++ b/libraries/stdlib/test/OldStdlibTest.kt @@ -14,7 +14,7 @@ class OldStdlibTest() { @test fun testCollectionSize() { assertTrue { - listOf(0, 1, 2).size() == 3 + listOf(0, 1, 2).size == 3 } } diff --git a/libraries/stdlib/test/TuplesTest.kt b/libraries/stdlib/test/TuplesTest.kt index 6c1284505c9..f97ae624ea0 100644 --- a/libraries/stdlib/test/TuplesTest.kt +++ b/libraries/stdlib/test/TuplesTest.kt @@ -41,7 +41,7 @@ class PairTest { @test fun pairHashSet() { val s = hashSetOf(Pair(1, "a"), Pair(1, "b"), Pair(1, "a")) - assertEquals(2, s.size()) + assertEquals(2, s.size) assertTrue(s.contains(p)) } @@ -92,7 +92,7 @@ class TripleTest { @test fun tripleHashSet() { val s = hashSetOf(Triple(1, "a", 0.07), Triple(1, "b", 0.07), Triple(1, "a", 0.07)) - assertEquals(2, s.size()) + assertEquals(2, s.size) assertTrue(s.contains(t)) } diff --git a/libraries/stdlib/test/collections/ArraysJVMTest.kt b/libraries/stdlib/test/collections/ArraysJVMTest.kt index e4ed7cb04c3..fce4f892f9e 100644 --- a/libraries/stdlib/test/collections/ArraysJVMTest.kt +++ b/libraries/stdlib/test/collections/ArraysJVMTest.kt @@ -10,14 +10,14 @@ class ArraysJVMTest { val y: Array? = null val xArray = x.orEmpty() val yArray = y.orEmpty() - expect(0) { xArray.size() } - expect(0) { yArray.size() } + expect(0) { xArray.size } + expect(0) { yArray.size } } @test fun orEmptyNotNull() { val x: Array? = arrayOf("1", "2") val xArray = x.orEmpty() - expect(2) { xArray.size() } + expect(2) { xArray.size } expect("1") { xArray[0] } expect("2") { xArray[1] } } diff --git a/libraries/stdlib/test/collections/ArraysTest.kt b/libraries/stdlib/test/collections/ArraysTest.kt index 5551cde5ebc..508e53bd5ff 100644 --- a/libraries/stdlib/test/collections/ArraysTest.kt +++ b/libraries/stdlib/test/collections/ArraysTest.kt @@ -40,7 +40,7 @@ class ArraysTest { val arr = ByteArray(2) val expected: Byte = 0 - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(expected, arr[0]) assertEquals(expected, arr[1]) } @@ -49,7 +49,7 @@ class ArraysTest { val arr = ShortArray(2) val expected: Short = 0 - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(expected, arr[0]) assertEquals(expected, arr[1]) } @@ -57,7 +57,7 @@ class ArraysTest { @test fun intArray() { val arr = IntArray(2) - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(0, arr[0]) assertEquals(0, arr[1]) } @@ -66,7 +66,7 @@ class ArraysTest { val arr = LongArray(2) val expected: Long = 0 - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(expected, arr[0]) assertEquals(expected, arr[1]) } @@ -75,7 +75,7 @@ class ArraysTest { val arr = FloatArray(2) val expected: Float = 0.0F - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(expected, arr[0]) assertEquals(expected, arr[1]) } @@ -83,7 +83,7 @@ class ArraysTest { @test fun doubleArray() { val arr = DoubleArray(2) - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(0.0, arr[0]) assertEquals(0.0, arr[1]) } @@ -92,14 +92,14 @@ class ArraysTest { val arr = CharArray(2) val expected: Char = '\u0000' - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(expected, arr[0]) assertEquals(expected, arr[1]) } @test fun booleanArray() { val arr = BooleanArray(2) - assertEquals(arr.size(), 2) + assertEquals(arr.size, 2) assertEquals(false, arr[0]) assertEquals(false, arr[1]) } @@ -151,7 +151,7 @@ class ArraysTest { expect(1, { arrayOf(1).minBy { it } }) expect(3, { arrayOf(2, 3).minBy { -it } }) expect('a', { arrayOf('a', 'b').minBy { "x$it" } }) - expect("b", { arrayOf("b", "abc").minBy { it.length() } }) + expect("b", { arrayOf("b", "abc").minBy { it.length } }) } @test fun minByInPrimitiveArrays() { @@ -170,7 +170,7 @@ class ArraysTest { expect(1, { arrayOf(1).maxBy { it } }) expect(2, { arrayOf(2, 3).maxBy { -it } }) expect('b', { arrayOf('a', 'b').maxBy { "x$it" } }) - expect("abc", { arrayOf("b", "abc").maxBy { it.length() } }) + expect("abc", { arrayOf("b", "abc").maxBy { it.length } }) } @test fun maxByInPrimitiveArrays() { @@ -461,7 +461,7 @@ class ArraysTest { @test fun toPrimitiveArray() { val genericArray: Array = arrayOf(1, 2, 3) val primitiveArray: IntArray = genericArray.toIntArray() - expect(3) { primitiveArray.size() } + expect(3) { primitiveArray.size } assertEquals(genericArray.asList(), primitiveArray.asList()) @@ -473,7 +473,7 @@ class ArraysTest { @test fun toTypedArray() { val primitiveArray: LongArray = longArrayOf(1, 2, Long.MAX_VALUE) val genericArray: Array = primitiveArray.toTypedArray() - expect(3) { genericArray.size() } + expect(3) { genericArray.size } assertEquals(primitiveArray.asList(), genericArray.asList()) } diff --git a/libraries/stdlib/test/collections/CollectionBehaviors.kt b/libraries/stdlib/test/collections/CollectionBehaviors.kt index 033ca2a5a29..a32a193ed2d 100644 --- a/libraries/stdlib/test/collections/CollectionBehaviors.kt +++ b/libraries/stdlib/test/collections/CollectionBehaviors.kt @@ -25,19 +25,19 @@ public fun CompareContext>.listBehavior() { compareProperty( { listIterator(0) }, { listIteratorBehavior() }) propertyFails { listIterator(-1) } - propertyFails { listIterator(size() + 1) } + propertyFails { listIterator(size + 1) } for (index in expected.indices) propertyEquals { this[index] } - propertyFails { this[size()] } + propertyFails { this[size] } propertyEquals { (this as List).indexOf(elementAtOrNull(0)) } propertyEquals { (this as List).lastIndexOf(elementAtOrNull(0)) } - propertyFails { subList(0, size() + 1)} + propertyFails { subList(0, size + 1)} propertyFails { subList(-1, 0)} - propertyEquals { subList(0, size()) } + propertyEquals { subList(0, size) } } public fun CompareContext>.listIteratorBehavior() { @@ -81,7 +81,7 @@ public fun CompareContext>.setBehavior(objectName: String = "") { public fun CompareContext>.mapBehavior() { equalityBehavior() - propertyEquals { size() } + propertyEquals { size } propertyEquals { isEmpty() } (object {}).let { propertyEquals { containsKey(it)} } @@ -108,7 +108,7 @@ public fun CompareContext.equalityBehavior(objectName: String = "") { public fun CompareContext>.collectionBehavior(objectName: String = "") { val prefix = objectName + if (objectName.isNotEmpty()) "." else "" - propertyEquals (prefix + "size") { size() } + propertyEquals (prefix + "size") { size } propertyEquals (prefix + "isEmpty") { isEmpty() } (object {}).let { propertyEquals { containsRaw(it)} } diff --git a/libraries/stdlib/test/collections/CollectionJVMTest.kt b/libraries/stdlib/test/collections/CollectionJVMTest.kt index 3cb78960275..14b34a0048b 100644 --- a/libraries/stdlib/test/collections/CollectionJVMTest.kt +++ b/libraries/stdlib/test/collections/CollectionJVMTest.kt @@ -39,7 +39,7 @@ class CollectionJVMTest { val data = listOf("", "foo", "bar", "x", "") val characters = data.flatMap { it.toCharList() } println("Got list of characters ${characters}") - assertEquals(7, characters.size()) + assertEquals(7, characters.size) val text = characters.joinToString("") assertEquals("foobarx", text) } @@ -52,7 +52,7 @@ class CollectionJVMTest { assertTrue { foo.all { it.startsWith("f") } } - assertEquals(1, foo.size()) + assertEquals(1, foo.size) assertEquals(linkedListOf("foo"), foo) assertTrue { @@ -67,7 +67,7 @@ class CollectionJVMTest { assertTrue { foo.all { !it.startsWith("f") } } - assertEquals(1, foo.size()) + assertEquals(1, foo.size) assertEquals(linkedListOf("bar"), foo) assertTrue { @@ -79,7 +79,7 @@ class CollectionJVMTest { val data = listOf(null, "foo", null, "bar") val foo = data.filterNotNullTo(linkedListOf()) - assertEquals(2, foo.size()) + assertEquals(2, foo.size) assertEquals(linkedListOf("foo", "bar"), foo) assertTrue { @@ -89,8 +89,8 @@ class CollectionJVMTest { @test fun filterIntoSortedSet() { val data = listOf("foo", "bar") - val sorted = data.filterTo(sortedSetOf()) { it.length() == 3 } - assertEquals(2, sorted.size()) + val sorted = data.filterTo(sortedSetOf()) { it.length == 3 } + assertEquals(2, sorted.size) assertEquals(sortedSetOf("bar", "foo"), sorted) assertTrue { sorted is TreeSet @@ -120,7 +120,7 @@ class CollectionJVMTest { val data = listOf("foo", "bar") val arr = data.toTypedArray() println("Got array ${arr}") - assertEquals(2, arr.size()) + assertEquals(2, arr.size) todo { assertTrue { arr.isArrayOf() @@ -148,7 +148,7 @@ class CollectionJVMTest { assertEquals(values.toList(), anyValues) val charValues: List = values.filterIsInstance() - assertEquals(0, charValues.size()) + assertEquals(0, charValues.size) } @test fun filterIsInstanceArray() { @@ -167,7 +167,7 @@ class CollectionJVMTest { assertEquals(src.toList(), anyValues) val charValues: List = src.filterIsInstance() - assertEquals(0, charValues.size()) + assertEquals(0, charValues.size) } @test fun emptyListIsSerializable() = testSingletonSerialization(emptyList()) diff --git a/libraries/stdlib/test/collections/CollectionTest.kt b/libraries/stdlib/test/collections/CollectionTest.kt index 7105685882d..53e7b99ee55 100644 --- a/libraries/stdlib/test/collections/CollectionTest.kt +++ b/libraries/stdlib/test/collections/CollectionTest.kt @@ -28,7 +28,7 @@ class CollectionTest { val data = listOf(null, "foo", null, "bar") val foo = data.filterNotNull() - assertEquals(2, foo.size()) + assertEquals(2, foo.size) assertEquals(listOf("foo", "bar"), foo) assertTrue { @@ -68,7 +68,7 @@ class CollectionTest { assertTrue { foo.all { it.startsWith("f") } } - assertEquals(1, foo.size()) + assertEquals(1, foo.size) assertEquals(hashSetOf("foo"), foo) assertTrue { @@ -98,7 +98,7 @@ class CollectionTest { @test fun foldWithDifferentTypes() { expect(7) { val numbers = listOf("a", "ab", "abc") - numbers.fold(1) { a, b -> a + b.length() } + numbers.fold(1) { a, b -> a + b.length } } expect("1234") { @@ -151,7 +151,7 @@ class CollectionTest { @test fun partition() { val data = listOf("foo", "bar", "something", "xyz") - val pair = data.partition { it.length() == 3 } + val pair = data.partition { it.length == 3 } assertEquals(listOf("foo", "bar", "xyz"), pair.first, "pair.first") assertEquals(listOf("something"), pair.second, "pair.second") @@ -185,8 +185,8 @@ class CollectionTest { @test fun groupBy() { val words = listOf("a", "abc", "ab", "def", "abcd") - val byLength = words.groupBy { it.length() } - assertEquals(4, byLength.size()) + val byLength = words.groupBy { it.length } + assertEquals(4, byLength.size) // verify that order of keys is preserved val listOfPairs = byLength.toList() @@ -196,7 +196,7 @@ class CollectionTest { assertEquals(4, listOfPairs[3].first) val l3 = byLength.getOrElse(3, { ArrayList() }) - assertEquals(2, l3.size()) + assertEquals(2, l3.size) } @test fun plusRanges() { @@ -350,8 +350,8 @@ class CollectionTest { @test fun dropLast() { val coll = listOf("foo", "bar", "abc") assertEquals(coll, coll.dropLast(0)) - assertEquals(emptyList(), coll.dropLast(coll.size())) - assertEquals(emptyList(), coll.dropLast(coll.size() + 1)) + assertEquals(emptyList(), coll.dropLast(coll.size)) + assertEquals(emptyList(), coll.dropLast(coll.size + 1)) assertEquals(listOf("foo", "bar"), coll.dropLast(1)) assertEquals(listOf("foo"), coll.dropLast(2)) @@ -362,7 +362,7 @@ class CollectionTest { val coll = listOf("Foo", "bare", "abc" ) assertEquals(coll, coll.dropLastWhile { false }) assertEquals(listOf(), coll.dropLastWhile { true }) - assertEquals(listOf("Foo", "bare"), coll.dropLastWhile { it.length() < 4 }) + assertEquals(listOf("Foo", "bare"), coll.dropLastWhile { it.length < 4 }) assertEquals(listOf("Foo"), coll.dropLastWhile { it.all { it in 'a'..'z' } }) } @@ -371,8 +371,8 @@ class CollectionTest { assertEquals(emptyList(), coll.take(0)) assertEquals(listOf("foo"), coll.take(1)) assertEquals(listOf("foo", "bar"), coll.take(2)) - assertEquals(coll, coll.take(coll.size())) - assertEquals(coll, coll.take(coll.size() + 1)) + assertEquals(coll, coll.take(coll.size)) + assertEquals(coll, coll.take(coll.size + 1)) assertFails { coll.take(-1) } } @@ -382,7 +382,7 @@ class CollectionTest { assertEquals(emptyList(), coll.takeWhile { false }) assertEquals(coll, coll.takeWhile { true }) assertEquals(listOf("foo"), coll.takeWhile { it.startsWith("f") }) - assertEquals(listOf("foo", "bar", "abc"), coll.takeWhile { it.length() == 3 }) + assertEquals(listOf("foo", "bar", "abc"), coll.takeWhile { it.length == 3 }) } @test fun takeLast() { @@ -391,8 +391,8 @@ class CollectionTest { assertEquals(emptyList(), coll.takeLast(0)) assertEquals(listOf("abc"), coll.takeLast(1)) assertEquals(listOf("bar", "abc"), coll.takeLast(2)) - assertEquals(coll, coll.takeLast(coll.size())) - assertEquals(coll, coll.takeLast(coll.size() + 1)) + assertEquals(coll, coll.takeLast(coll.size)) + assertEquals(coll, coll.takeLast(coll.size + 1)) assertFails { coll.takeLast(-1) } } @@ -409,7 +409,7 @@ class CollectionTest { val data = listOf("foo", "bar") val arr = data.toTypedArray() println("Got array ${arr}") - assertEquals(2, arr.size()) + assertEquals(2, arr.size) } @test fun count() { @@ -463,7 +463,7 @@ class CollectionTest { val indices = data.indices assertEquals(0, indices.start) assertEquals(1, indices.end) - assertEquals(0..data.size() - 1, indices) + assertEquals(0..data.size - 1, indices) } @test fun contains() { @@ -500,7 +500,7 @@ class CollectionTest { expect(1, { listOf(1).minBy { it } }) expect(3, { listOf(2, 3).minBy { -it } }) expect('a', { listOf('a', 'b').minBy { "x$it" } }) - expect("b", { listOf("b", "abc").minBy { it.length() } }) + expect("b", { listOf("b", "abc").minBy { it.length } }) expect(null, { listOf().asSequence().minBy { it } }) expect(3, { listOf(2, 3).asSequence().minBy { -it } }) } @@ -510,7 +510,7 @@ class CollectionTest { expect(1, { listOf(1).maxBy { it } }) expect(2, { listOf(2, 3).maxBy { -it } }) expect('b', { listOf('a', 'b').maxBy { "x$it" } }) - expect("abc", { listOf("b", "abc").maxBy { it.length() } }) + expect("abc", { listOf("b", "abc").maxBy { it.length } }) expect(null, { listOf().asSequence().maxBy { it } }) expect(2, { listOf(2, 3).asSequence().maxBy { -it } }) } @@ -609,7 +609,7 @@ class CollectionTest { } @test fun sortedByNullable() { - fun String.nonEmptyLength() = if (isEmpty()) null else length() + fun String.nonEmptyLength() = if (isEmpty()) null else length listOf("", "sort", "abc").let { assertEquals(listOf("", "abc", "sort"), it.sortedBy { it.nonEmptyLength() }) assertEquals(listOf("sort", "abc", ""), it.sortedByDescending { it.nonEmptyLength() }) diff --git a/libraries/stdlib/test/collections/IterableTests.kt b/libraries/stdlib/test/collections/IterableTests.kt index 5ad6e2c67d8..29fad376485 100644 --- a/libraries/stdlib/test/collections/IterableTests.kt +++ b/libraries/stdlib/test/collections/IterableTests.kt @@ -48,7 +48,7 @@ abstract class OrderedIterableTests>(data: T, empty: T) : I @Test fun indexOfLast() { expect(-1) { data.indexOfLast { it.contains("p") } } - expect(1) { data.indexOfLast { it.length() == 3 } } + expect(1) { data.indexOfLast { it.length == 3 } } expect(-1) { empty.indexOfLast { it.startsWith('f') } } } @@ -122,7 +122,7 @@ abstract class IterableTests>(val data: T, val empty: T) { @Test fun all() { - expect(true) { data.all { it.length() == 3 } } + expect(true) { data.all { it.length == 3 } } expect(false) { data.all { it.startsWith("b") } } expect(true) { empty.all { it.startsWith("b") } } } @@ -131,7 +131,7 @@ abstract class IterableTests>(val data: T, val empty: T) { fun none() { expect(false) { data.none() } expect(true) { empty.none() } - expect(false) { data.none { it.length() == 3 } } + expect(false) { data.none { it.length == 3 } } expect(false) { data.none { it.startsWith("b") } } expect(true) { data.none { it.startsWith("x") } } expect(true) { empty.none { it.startsWith("b") } } @@ -181,7 +181,7 @@ abstract class IterableTests>(val data: T, val empty: T) { @Test fun forEach() { var count = 0 - data.forEach { count += it.length() } + data.forEach { count += it.length } assertEquals(6, count) } @@ -200,7 +200,7 @@ abstract class IterableTests>(val data: T, val empty: T) { expect("foo") { data.single { it.startsWith("f") } } expect("bar") { data.single { it.startsWith("b") } } assertFails { - data.single { it.length() == 3 } + data.single { it.length == 3 } } } @@ -211,13 +211,13 @@ abstract class IterableTests>(val data: T, val empty: T) { expect("foo") { data.singleOrNull { it.startsWith("f") } } expect("bar") { data.singleOrNull { it.startsWith("b") } } expect(null) { - data.singleOrNull { it.length() == 3 } + data.singleOrNull { it.length == 3 } } } @Test fun map() { - val lengths = data.map { it.length() } + val lengths = data.map { it.length } assertTrue { lengths.all { it == 3 } } @@ -227,7 +227,7 @@ abstract class IterableTests>(val data: T, val empty: T) { @Test fun flatten() { - assertEquals(listOf(0, 1, 2, 3, 0, 1, 2, 3), data.map { 0..it.length() }.flatten()) + assertEquals(listOf(0, 1, 2, 3, 0, 1, 2, 3), data.map { 0..it.length }.flatten()) } @Test @@ -280,11 +280,11 @@ abstract class IterableTests>(val data: T, val empty: T) { @Test fun sumBy() { - expect(6) { data.sumBy { it.length() } } - expect(0) { empty.sumBy { it.length() } } + expect(6) { data.sumBy { it.length } } + expect(0) { empty.sumBy { it.length } } - expect(3.0) { data.sumByDouble { it.length().toDouble() / 2 } } - expect(0.0) { empty.sumByDouble { it.length().toDouble() / 2 } } + expect(3.0) { data.sumByDouble { it.length.toDouble() / 2 } } + expect(0.0) { empty.sumByDouble { it.length.toDouble() / 2 } } } @Test @@ -306,7 +306,7 @@ abstract class IterableTests>(val data: T, val empty: T) { @Test fun reduce() { val reduced = data.reduce { a, b -> a + b } - assertEquals(6, reduced.length()) + assertEquals(6, reduced.length) assertTrue(reduced == "foobar" || reduced == "barfoo") } diff --git a/libraries/stdlib/test/collections/ListBinarySearchTest.kt b/libraries/stdlib/test/collections/ListBinarySearchTest.kt index fb159f73098..524aee58527 100644 --- a/libraries/stdlib/test/collections/ListBinarySearchTest.kt +++ b/libraries/stdlib/test/collections/ListBinarySearchTest.kt @@ -21,7 +21,7 @@ class ListBinarySearchTest { if (index > 0) { index.let { from -> assertEquals(notFound(from), list.binarySearch(list.first(), fromIndex = from)) } - (list.size() - index).let { to -> assertEquals(notFound(to), list.binarySearch(list.last(), toIndex = to)) } + (list.size - index).let { to -> assertEquals(notFound(to), list.binarySearch(list.last(), toIndex = to)) } } } } @@ -34,7 +34,7 @@ class ListBinarySearchTest { if (index > 0) { index.let { from -> assertEquals(notFound(from), list.binarySearch(list.first(), fromIndex = from)) } - (list.size() - index).let { to -> assertEquals(notFound(to), list.binarySearch(list.last(), toIndex = to)) } + (list.size - index).let { to -> assertEquals(notFound(to), list.binarySearch(list.last(), toIndex = to)) } } } } @@ -50,7 +50,7 @@ class ListBinarySearchTest { if (index > 0) { index.let { from -> assertEquals(notFound(from), list.binarySearch(list.first(), comparator, fromIndex = from)) } - (list.size() - index).let { to -> assertEquals(notFound(to), list.binarySearch(list.last(), comparator, toIndex = to)) } + (list.size - index).let { to -> assertEquals(notFound(to), list.binarySearch(list.last(), comparator, toIndex = to)) } } } } @@ -66,7 +66,7 @@ class ListBinarySearchTest { if (index > 0) { index.let { from -> assertEquals(notFound(from), list.binarySearchBy(list.first().value, fromIndex = from) { it.value }) } - (list.size() - index).let { to -> assertEquals(notFound(to), list.binarySearchBy(list.last().value, toIndex = to) { it.value }) } + (list.size - index).let { to -> assertEquals(notFound(to), list.binarySearchBy(list.last().value, toIndex = to) { it.value }) } } } } @@ -85,7 +85,7 @@ class ListBinarySearchTest { index.let { from -> assertEquals(notFound(from), list.binarySearch(fromIndex = from) { comparator.compare(it.value, list.first().value) }) } - (list.size() - index).let { to -> + (list.size - index).let { to -> assertEquals(notFound(to), list.binarySearch(toIndex = to) { comparator.compare(it.value, list.last().value) }) } } diff --git a/libraries/stdlib/test/collections/ListSpecificTest.kt b/libraries/stdlib/test/collections/ListSpecificTest.kt index 4cf328ad853..9170047b735 100644 --- a/libraries/stdlib/test/collections/ListSpecificTest.kt +++ b/libraries/stdlib/test/collections/ListSpecificTest.kt @@ -63,7 +63,7 @@ class ListSpecificTest { list += item } - assertEquals(3, list.size()) + assertEquals(3, list.size) assertEquals("beverage,location,name", list.joinToString(",")) } diff --git a/libraries/stdlib/test/collections/MapJVMTest.kt b/libraries/stdlib/test/collections/MapJVMTest.kt index 45d155a69a2..412b58b821f 100644 --- a/libraries/stdlib/test/collections/MapJVMTest.kt +++ b/libraries/stdlib/test/collections/MapJVMTest.kt @@ -26,7 +26,7 @@ class MapJVMTest { @test fun toSortedMapWithComparator() { val map = mapOf(Pair("c", 3), Pair("bc", 2), Pair("bd", 4), Pair("abc", 1)) - val sorted = map.toSortedMap(compareBy { it.length() } thenBy { it }) + val sorted = map.toSortedMap(compareBy { it.length } thenBy { it }) assertEquals(listOf("c", "bc", "bd", "abc"), sorted.keySet().toList()) assertEquals(1, sorted["abc"]) assertEquals(2, sorted["bc"]) @@ -36,7 +36,7 @@ class MapJVMTest { @test fun toProperties() { val map = mapOf("a" to "A", "b" to "B") val prop = map.toProperties() - assertEquals(2, prop.size()) + assertEquals(2, prop.size) assertEquals("A", prop.getProperty("a", "fail")) assertEquals("B", prop.getProperty("b", "fail")) } diff --git a/libraries/stdlib/test/collections/MapTest.kt b/libraries/stdlib/test/collections/MapTest.kt index 937357cc750..f2eaa12f5d1 100644 --- a/libraries/stdlib/test/collections/MapTest.kt +++ b/libraries/stdlib/test/collections/MapTest.kt @@ -13,7 +13,7 @@ class MapTest { val b = data.getOrElse("foo") { 3 } assertEquals(3, b) - assertEquals(0, data.size()) + assertEquals(0, data.size) val empty = mapOf() val c = empty.getOrElse("") { null } @@ -34,7 +34,7 @@ class MapTest { data["bar"] = 3 assertEquals(3, mutableWithDefault["bar"]) - val readonlyWithDefault = (data as Map).withDefault { it.length() } + val readonlyWithDefault = (data as Map).withDefault { it.length } assertEquals(4, readonlyWithDefault.getOrImplicitDefault("loop")) val withReplacedDefault = readonlyWithDefault.withDefault { 42 } @@ -49,7 +49,7 @@ class MapTest { val b = data.getOrPut("foo") { 3 } assertEquals(2, b) - assertEquals(1, data.size()) + assertEquals(1, data.size) val empty = hashMapOf() val c = empty.getOrPut("") { null } @@ -59,18 +59,18 @@ class MapTest { @test fun sizeAndEmpty() { val data = hashMapOf() assertTrue { data.none() } - assertEquals(data.size(), 0) + assertEquals(data.size, 0) } @test fun setViaIndexOperators() { val map = hashMapOf() assertTrue { map.none() } - assertEquals(map.size(), 0) + assertEquals(map.size, 0) map["name"] = "James" assertTrue { map.any() } - assertEquals(map.size(), 1) + assertEquals(map.size, 1) assertEquals("James", map["name"]) } @@ -82,7 +82,7 @@ class MapTest { list.add(e.getValue()) } - assertEquals(6, list.size()) + assertEquals(6, list.size) assertEquals("beverage,beer,location,Mells,name,James", list.joinToString(",")) } @@ -100,7 +100,7 @@ class MapTest { list.add(e.value) } - assertEquals(6, list.size()) + assertEquals(6, list.size) assertEquals("beverage,beer,location,Mells,name,James", list.joinToString(",")) } @@ -112,7 +112,7 @@ class MapTest { list.add(value) } - assertEquals(6, list.size()) + assertEquals(6, list.size) assertEquals("beverage,beer,location,Mells,name,James", list.joinToString(",")) } @@ -154,36 +154,36 @@ class MapTest { @test fun createUsingPairs() { val map = mapOf(Pair("a", 1), Pair("b", 2)) - assertEquals(2, map.size()) + assertEquals(2, map.size) assertEquals(1, map["a"]) assertEquals(2, map["b"]) } @test fun createFromIterable() { val map = listOf(Pair("a", 1), Pair("b", 2)).toMap() - assertEquals(2, map.size()) + assertEquals(2, map.size) assertEquals(1, map.get("a")) assertEquals(2, map.get("b")) } @test fun createWithSelector() { - val map = listOf("a", "bb", "ccc").toMapBy { it.length() } - assertEquals(3, map.size()) + val map = listOf("a", "bb", "ccc").toMapBy { it.length } + assertEquals(3, map.size) assertEquals("a", map.get(1)) assertEquals("bb", map.get(2)) assertEquals("ccc", map.get(3)) } @test fun createWithSelectorAndOverwrite() { - val map = listOf("aa", "bb", "ccc").toMapBy { it.length() } - assertEquals(2, map.size()) + val map = listOf("aa", "bb", "ccc").toMapBy { it.length } + assertEquals(2, map.size) assertEquals("bb", map.get(2)) assertEquals("ccc", map.get(3)) } @test fun createWithSelectorForKeyAndValue() { - val map = listOf("a", "bb", "ccc").toMap({ it.length() }, { it.toUpperCase() }) - assertEquals(3, map.size()) + val map = listOf("a", "bb", "ccc").toMap({ it.length }, { it.toUpperCase() }) + assertEquals(3, map.size) assertEquals("A", map.get(1)) assertEquals("BB", map.get(2)) assertEquals("CCC", map.get(3)) @@ -191,7 +191,7 @@ class MapTest { @test fun createUsingTo() { val map = mapOf("a" to 1, "b" to 2) - assertEquals(2, map.size()) + assertEquals(2, map.size) assertEquals(1, map["a"]) assertEquals(2, map["b"]) } @@ -207,21 +207,21 @@ class MapTest { @test fun filter() { val map = mapOf(Pair("b", 3), Pair("c", 2), Pair("a", 2)) val filteredByKey = map.filter { it.key == "b" } - assertEquals(1, filteredByKey.size()) + assertEquals(1, filteredByKey.size) assertEquals(3, filteredByKey["b"]) val filteredByKey2 = map.filterKeys { it == "b" } - assertEquals(1, filteredByKey2.size()) + assertEquals(1, filteredByKey2.size) assertEquals(3, filteredByKey2["b"]) val filteredByValue = map.filter { it.value == 2 } - assertEquals(2, filteredByValue.size()) + assertEquals(2, filteredByValue.size) assertEquals(null, filteredByValue["b"]) assertEquals(2, filteredByValue["c"]) assertEquals(2, filteredByValue["a"]) val filteredByValue2 = map.filterValues { it == 2 } - assertEquals(2, filteredByValue2.size()) + assertEquals(2, filteredByValue2.size) assertEquals(null, filteredByValue2["b"]) assertEquals(2, filteredByValue2["c"]) assertEquals(2, filteredByValue2["a"]) @@ -262,20 +262,20 @@ class MapTest { @test fun filterNot() { val map = mapOf(Pair("b", 3), Pair("c", 2), Pair("a", 2)) val filteredByKey = map.filterNot { it.key == "b" } - assertEquals(2, filteredByKey.size()) + assertEquals(2, filteredByKey.size) assertEquals(null, filteredByKey["b"]) assertEquals(2, filteredByKey["c"]) assertEquals(2, filteredByKey["a"]) val filteredByValue = map.filterNot { it.value == 2 } - assertEquals(1, filteredByValue.size()) + assertEquals(1, filteredByValue.size) assertEquals(3, filteredByValue["b"]) } fun testPlusAssign(doPlusAssign: (MutableMap) -> Unit) { val map = hashMapOf("a" to 1, "b" to 2) doPlusAssign(map) - assertEquals(3, map.size()) + assertEquals(3, map.size) assertEquals(1, map["a"]) assertEquals(4, map["b"]) assertEquals(3, map["c"]) @@ -297,7 +297,7 @@ class MapTest { fun testPlus(doPlus: (Map) -> Map) { val original = mapOf("A" to 1, "B" to 2) val extended = doPlus(original) - assertEquals(3, extended.size()) + assertEquals(3, extended.size) assertEquals(1, extended["A"]) assertEquals(4, extended["B"]) assertEquals(3, extended["C"]) diff --git a/libraries/stdlib/test/collections/SequenceJVMTest.kt b/libraries/stdlib/test/collections/SequenceJVMTest.kt index e7e37d1b0cb..1ccc8eb315b 100644 --- a/libraries/stdlib/test/collections/SequenceJVMTest.kt +++ b/libraries/stdlib/test/collections/SequenceJVMTest.kt @@ -21,6 +21,6 @@ class SequenceJVMTest { assertEquals(src.toList(), anyValues.toArrayList()) val charValues: Sequence = src.filterIsInstance() - assertEquals(0, charValues.toArrayList().size()) + assertEquals(0, charValues.toArrayList().size) } } diff --git a/libraries/stdlib/test/collections/SequenceTest.kt b/libraries/stdlib/test/collections/SequenceTest.kt index 581f8438d53..559301263dd 100644 --- a/libraries/stdlib/test/collections/SequenceTest.kt +++ b/libraries/stdlib/test/collections/SequenceTest.kt @@ -267,7 +267,7 @@ public class SequenceTest { @test fun sequenceExtensions() { val d = ArrayList() sequenceOf(0, 1, 2, 3, 4, 5).takeWhileTo(d, { i -> i < 4 }) - assertEquals(4, d.size()) + assertEquals(4, d.size) } @test fun flatMapAndTakeExtractTheTransformedElements() { @@ -330,8 +330,8 @@ public class SequenceTest { @test fun sortedBy() { sequenceOf("it", "greater", "less").let { - it.sortedBy { it.length() }.iterator().assertSorted { a, b -> compareValuesBy(a, b) { it.length() } <= 0 } - it.sortedByDescending { it.length() }.iterator().assertSorted { a, b -> compareValuesBy(a, b) { it.length() } >= 0 } + it.sortedBy { it.length }.iterator().assertSorted { a, b -> compareValuesBy(a, b) { it.length } <= 0 } + it.sortedByDescending { it.length }.iterator().assertSorted { a, b -> compareValuesBy(a, b) { it.length } >= 0 } } sequenceOf('a', 'd', 'c', null).let { diff --git a/libraries/stdlib/test/collections/SetOperationsTest.kt b/libraries/stdlib/test/collections/SetOperationsTest.kt index dff41568683..2dcbbf479c9 100644 --- a/libraries/stdlib/test/collections/SetOperationsTest.kt +++ b/libraries/stdlib/test/collections/SetOperationsTest.kt @@ -10,7 +10,7 @@ class SetOperationsTest { } @test fun distinctBy() { - assertEquals(listOf("some", "cat", "do"), arrayOf("some", "case", "cat", "do", "dog", "it").distinctBy { it.length() }) + assertEquals(listOf("some", "cat", "do"), arrayOf("some", "case", "cat", "do", "dog", "it").distinctBy { it.length }) assertTrue(charArrayOf().distinctBy { it }.isEmpty()) } diff --git a/libraries/stdlib/test/io/Files.kt b/libraries/stdlib/test/io/Files.kt index 8520a40b799..987f11ba032 100644 --- a/libraries/stdlib/test/io/Files.kt +++ b/libraries/stdlib/test/io/Files.kt @@ -359,7 +359,7 @@ class FilesTest { basedir.walkTopDown().enter(::beforeVisitDirectory).leave(::afterVisitDirectory).maxDepth(1). forEach { it -> if (it != basedir) visitFile(it) } assert(stack.isEmpty()) - assert(dirs.size() == 1 && dirs.contains("")) { dirs.size() } + assert(dirs.size == 1 && dirs.contains("")) { dirs.size } for (file in arrayOf("1", "6", "7.txt", "8")) { assert(files.contains(file)) { file } } @@ -372,12 +372,12 @@ class FilesTest { basedir.walkTopDown().enter(::beforeVisitDirectory).leave(::afterVisitDirectory). fail(::visitDirectoryFailed).forEach { it -> if (!it.isDirectory()) visitFile(it) } assert(stack.isEmpty()) - assert(failed.size() == 1 && failed.contains("1")) { failed.size() } - assert(dirs.size() == 4) { dirs.size() } + assert(failed.size == 1 && failed.contains("1")) { failed.size } + assert(dirs.size == 4) { dirs.size } for (dir in arrayOf("", "1", "6", "8")) { assert(dirs.contains(dir)) { dir } } - assert(files.size() == 2) { files.size() } + assert(files.size == 2) { files.size } for (file in arrayOf("7.txt", "8${sep}9.txt")) { assert(files.contains(file)) { file } } @@ -402,7 +402,7 @@ class FilesTest { visited.add(it) } basedir.walkTopDown().forEach(block) - assert(visited.size() == 10) { visited.size() } + assert(visited.size == 10) { visited.size } } finally { basedir.deleteRecursively() @@ -421,7 +421,7 @@ class FilesTest { visited.add(it) } basedir.walkTopDown().forEach(block) - assert(visited.size() == 6) { visited.size() } + assert(visited.size == 6) { visited.size } } } finally { restricted.setReadable(true) @@ -491,7 +491,7 @@ class FilesTest { found.add(file.getParentFile()) } } - assert(found.size() == 3) + assert(found.size == 3) } finally { basedir.deleteRecursively() } @@ -532,10 +532,10 @@ class FilesTest { // This line works only with Kotlin File.listFiles(filter) val result = dir.listFiles { it.getName().endsWith(".kt") } - assertEquals(2, result!!.size()) + assertEquals(2, result!!.size) // This line works both with Kotlin File.listFiles(filter) and the same Java function because of SAM val result2 = dir.listFiles { it -> it.getName().endsWith(".kt") } - assertEquals(2, result2!!.size()) + assertEquals(2, result2!!.size) } @test fun relativeToTest() { @@ -602,10 +602,10 @@ class FilesTest { var i = 0 assertEquals(root, f.root) for (elem in f.filePathComponents().fileList) { - assertTrue(i < elements.size(), i.toString()) + assertTrue(i < elements.size, i.toString()) assertEquals(elements[i++], elem.toString()) } - assertEquals(elements.size(), i) + assertEquals(elements.size, i) } @test fun fileIterator() { diff --git a/libraries/stdlib/test/js/JsArrayScript.kt b/libraries/stdlib/test/js/JsArrayScript.kt index 4195cd07568..639daee3ea1 100644 --- a/libraries/stdlib/test/js/JsArrayScript.kt +++ b/libraries/stdlib/test/js/JsArrayScript.kt @@ -6,7 +6,7 @@ fun testSize(): Int { val a2 = arrayOf("foo") val a3 = arrayOf("foo", "bar") - return a1.size() + a2.size() + a3.size() + return a1.size + a2.size + a3.size } fun testToListToString(): String { diff --git a/libraries/stdlib/test/js/JsArrayTest.kt b/libraries/stdlib/test/js/JsArrayTest.kt index efcabda558d..5d181f894de 100644 --- a/libraries/stdlib/test/js/JsArrayTest.kt +++ b/libraries/stdlib/test/js/JsArrayTest.kt @@ -11,9 +11,9 @@ class JsArrayTest { val a2 = arrayOf("foo") val a3 = arrayOf("foo", "bar") - assertEquals(0, a1.size()) - assertEquals(1, a2.size()) - assertEquals(2, a3.size()) + assertEquals(0, a1.size) + assertEquals(1, a2.size) + assertEquals(2, a3.size) assertEquals("[]", a1.toList().toString()) assertEquals("[foo]", a2.toList().toString()) @@ -25,7 +25,7 @@ class JsArrayTest { var c: Collection = arrayOf("A", "B", "C").toList() var a = ArrayList(c) - assertEquals(3, a.size()) + assertEquals(3, a.size) assertEquals("A", a[0]) assertEquals("B", a[1]) assertEquals("C", a[2]) diff --git a/libraries/stdlib/test/js/MapJsTest.kt b/libraries/stdlib/test/js/MapJsTest.kt index de7db87ca25..be15f601ba5 100644 --- a/libraries/stdlib/test/js/MapJsTest.kt +++ b/libraries/stdlib/test/js/MapJsTest.kt @@ -85,7 +85,7 @@ abstract class MapJsTest { val b = data.getOrElse("foo"){3} assertEquals(3, b) - assertEquals(0, data.size()) + assertEquals(0, data.size) } @test fun getOrPut() { @@ -96,7 +96,7 @@ abstract class MapJsTest { val b = data.getOrPut("foo"){3} assertEquals(2, b) - assertEquals(1, data.size()) + assertEquals(1, data.size) } @test fun emptyMapGet() { @@ -137,8 +137,8 @@ abstract class MapJsTest { assertTrue(data.isEmpty()) assertTrue(data.none()) - assertEquals(0, data.size()) - assertEquals(0, data.size()) + assertEquals(0, data.size) + assertEquals(0, data.size) } @test fun sizeAndEmpty() { @@ -147,7 +147,7 @@ abstract class MapJsTest { assertFalse(data.isEmpty()) assertFalse(data.none()) - assertEquals(KEYS.size(), data.size()) + assertEquals(KEYS.size, data.size) } // #KT-3035 @@ -208,16 +208,16 @@ abstract class MapJsTest { val map = createTestMap() val newMap = emptyMutableMap() newMap.putAll(map) - assertEquals(KEYS.size(), newMap.size()) + assertEquals(KEYS.size, newMap.size) } @test fun mapRemove() { val map = createTestMutableMap() - val last = KEYS.size() - 1 + val last = KEYS.size - 1 val first = 0 - val mid = KEYS.size() / 2 + val mid = KEYS.size / 2 - assertEquals(KEYS.size(), map.size()) + assertEquals(KEYS.size, map.size) assertEquals(null, map.remove("foo")) assertEquals(VALUES[mid], map.remove(KEYS[mid])) @@ -225,7 +225,7 @@ abstract class MapJsTest { assertEquals(VALUES[last], map.remove(KEYS[last])) assertEquals(VALUES[first], map.remove(KEYS[first])) - assertEquals(KEYS.size() - 3, map.size()) + assertEquals(KEYS.size - 3, map.size) } @test fun mapClear() { @@ -264,25 +264,25 @@ abstract class MapJsTest { @test fun setViaIndexOperators() { val map = HashMap() assertTrue{ map.isEmpty() } - assertEquals(map.size(), 0) + assertEquals(map.size, 0) map["name"] = "James" assertTrue{ !map.isEmpty() } - assertEquals(map.size(), 1) + assertEquals(map.size, 1) assertEquals("James", map["name"]) } @test fun createUsingPairs() { val map = mapOf(Pair("a", 1), Pair("b", 2)) - assertEquals(2, map.size()) + assertEquals(2, map.size) assertEquals(1, map.get("a")) assertEquals(2, map.get("b")) } @test fun createUsingTo() { val map = mapOf("a" to 1, "b" to 2) - assertEquals(2, map.size()) + assertEquals(2, map.size) assertEquals(1, map.get("a")) assertEquals(2, map.get("b")) } diff --git a/libraries/stdlib/test/js/SetJsTest.kt b/libraries/stdlib/test/js/SetJsTest.kt index e602be5021f..8dafeb5959a 100644 --- a/libraries/stdlib/test/js/SetJsTest.kt +++ b/libraries/stdlib/test/js/SetJsTest.kt @@ -80,8 +80,8 @@ abstract class SetJsTest { @Test fun size() { - assertEquals(2, data.size()) - assertEquals(0, empty.size()) + assertEquals(2, data.size) + assertEquals(0, empty.size) } @Test @@ -132,9 +132,9 @@ abstract class SetJsTest { fun add() { val data = createTestMutableSet() assertTrue(data.add("baz")) - assertEquals(3, data.size()) + assertEquals(3, data.size) assertFalse(data.add("baz")) - assertEquals(3, data.size()) + assertEquals(3, data.size) assertTrue(data.containsAll(arrayListOf("foo", "bar", "baz"))) } @@ -142,9 +142,9 @@ abstract class SetJsTest { fun remove() { val data = createTestMutableSet() assertTrue(data.remove("foo")) - assertEquals(1, data.size()) + assertEquals(1, data.size) assertFalse(data.remove("foo")) - assertEquals(1, data.size()) + assertEquals(1, data.size) assertTrue(data.contains("bar")) } @@ -152,9 +152,9 @@ abstract class SetJsTest { fun addAll() { val data = createTestMutableSet() assertTrue(data.addAll(arrayListOf("foo", "bar", "baz", "boo"))) - assertEquals(4, data.size()) + assertEquals(4, data.size) assertFalse(data.addAll(arrayListOf("foo", "bar", "baz", "boo"))) - assertEquals(4, data.size()) + assertEquals(4, data.size) assertTrue(data.containsAll(arrayListOf("foo", "bar", "baz", "boo"))) } @@ -163,12 +163,12 @@ abstract class SetJsTest { val data = createTestMutableSet() assertFalse(data.removeAll(arrayListOf("baz"))) assertTrue(data.containsAll(arrayListOf("foo", "bar"))) - assertEquals(2, data.size()) + assertEquals(2, data.size) assertTrue(data.removeAll(arrayListOf("foo"))) assertTrue(data.contains("bar")) - assertEquals(1, data.size()) + assertEquals(1, data.size) assertTrue(data.removeAll(arrayListOf("foo", "bar"))) - assertEquals(0, data.size()) + assertEquals(0, data.size) val data2 = createTestMutableSet() assertFalse(data.removeAll(arrayListOf("foo", "bar", "baz"))) @@ -184,7 +184,7 @@ abstract class SetJsTest { val data2 = createTestMutableSet() assertTrue(data2.retainAll(arrayListOf("foo"))) assertTrue(data2.contains("foo")) - assertEquals(1, data2.size()) + assertEquals(1, data2.size) } @Test diff --git a/libraries/stdlib/test/text/RegexTest.kt b/libraries/stdlib/test/text/RegexTest.kt index b224299336c..f314e87f7c2 100644 --- a/libraries/stdlib/test/text/RegexTest.kt +++ b/libraries/stdlib/test/text/RegexTest.kt @@ -137,7 +137,7 @@ class RegexTest { @test fun replaceEvaluator() { val input = "/12/456/7890/" val pattern = "\\d+".toRegex() - assertEquals("/2/3/4/", pattern.replace(input, { it.value.length().toString() } )) + assertEquals("/2/3/4/", pattern.replace(input, { it.value.length.toString() } )) } diff --git a/libraries/stdlib/test/text/StringBuilderTest.kt b/libraries/stdlib/test/text/StringBuilderTest.kt index ae69f3d39b5..4facc9c654d 100644 --- a/libraries/stdlib/test/text/StringBuilderTest.kt +++ b/libraries/stdlib/test/text/StringBuilderTest.kt @@ -32,8 +32,8 @@ class StringBuilderTest { val result = sb.toString() val cs = sb as CharSequence - assertEquals(result.length(), cs.length()) - assertEquals(result.length(), sb.length()) + assertEquals(result.length, cs.length) + assertEquals(result.length, sb.length) for (index in result.indices) { assertEquals(result[index], sb[index]) assertEquals(result[index], cs[index]) @@ -43,22 +43,22 @@ class StringBuilderTest { @test fun constructors() { StringBuilder().let { sb -> - assertEquals(0, sb.length()) + assertEquals(0, sb.length) assertEquals("", sb.toString()) } StringBuilder(16).let { sb -> - assertEquals(0, sb.length()) + assertEquals(0, sb.length) assertEquals("", sb.toString()) } StringBuilder("content").let { sb -> - assertEquals(7, sb.length()) + assertEquals(7, sb.length) assertEquals("content", sb.toString()) } StringBuilder(StringBuilder("content")).let { sb -> - assertEquals(7, sb.length()) + assertEquals(7, sb.length) assertEquals("content", sb.toString()) } } diff --git a/libraries/stdlib/test/text/StringTest.kt b/libraries/stdlib/test/text/StringTest.kt index 100c43e91dd..8c474e5b043 100644 --- a/libraries/stdlib/test/text/StringTest.kt +++ b/libraries/stdlib/test/text/StringTest.kt @@ -927,7 +927,7 @@ class StringTest { assertFails { data.drop(-2) } - assertEquals("", data.drop(data.length() + 5)) + assertEquals("", data.drop(data.length + 5)) } @test fun dropCharSequence() = withOneCharSequenceArg("abcd1234") { data -> @@ -935,7 +935,7 @@ class StringTest { assertFails { data.drop(-2) } - assertContentEquals("", data.drop(data.length() + 5)) + assertContentEquals("", data.drop(data.length + 5)) } @test fun takeWhile() { @@ -957,7 +957,7 @@ class StringTest { assertFails { data.take(-7) } - assertEquals(data, data.take(data.length() + 42)) + assertEquals(data, data.take(data.length + 42)) } @test fun takeCharSequence() = withOneCharSequenceArg("abcd1234") { data -> @@ -1102,7 +1102,7 @@ ${" "} `XP ' '''''' YPXXXXXX' ''''''`''YPPP """.trimIndent() - assertEquals(23, deindented.lines().size()) + assertEquals(23, deindented.lines().size) val indents = deindented.lines().map { "^\\s*".toRegex().find(it)!!.value.length } assertEquals(0, indents.min()) assertEquals(42, indents.max()) diff --git a/libraries/stdlib/test/utils/TODOTest.kt b/libraries/stdlib/test/utils/TODOTest.kt index b066020847f..7aea131a54d 100644 --- a/libraries/stdlib/test/utils/TODOTest.kt +++ b/libraries/stdlib/test/utils/TODOTest.kt @@ -13,7 +13,7 @@ private class PartiallyImplementedClass { if (!switch) TODO("what if false") else { - if (value.length() < 3) + if (value.length < 3) throw TODO("write message") } diff --git a/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt b/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt index bd7fe065133..e8210c79671 100644 --- a/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt +++ b/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt @@ -60,7 +60,7 @@ public abstract class KotlinAnnotationProvider { val shortenedValue = shortenedPackageNameCache.get(id) ?: throw RuntimeException("Value for $id couldn't be found in shrink cache") - return shortenedValue + '.' + s.substring(id.length() + 1) + return shortenedValue + '.' + s.substring(id.length + 1) } val annotatedKotlinElements: MutableMap> = hashMapOf() @@ -82,7 +82,7 @@ public abstract class KotlinAnnotationProvider { ANNOTATED_CLASS, ANNOTATED_FIELD, ANNOTATED_METHOD -> { val annotationName = expandAnnotation(lineParts[1]) val classFqName = expandClassName(lineParts[2]).replace('$', '.') - val elementName = if (lineParts.size() == 4) lineParts[3] else null + val elementName = if (lineParts.size == 4) lineParts[3] else null val set = annotatedKotlinElements.getOrPut(annotationName) { hashSetOf() } set.add(when (type) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/AnnotationProcessingManager.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/AnnotationProcessingManager.kt index d22adf052fb..ae97325dc7d 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/AnnotationProcessingManager.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/AnnotationProcessingManager.kt @@ -271,7 +271,7 @@ public class AnnotationProcessingManager( modifyCompilerArguments { args -> val argIndex = args.indexOfFirst { name == it } - if (argIndex >= 0 && args.size() > (argIndex + 1)) { + if (argIndex >= 0 && args.size > (argIndex + 1)) { args[argIndex + 1] = value(args[argIndex + 1]) } else { @@ -334,7 +334,7 @@ public class AnnotationProcessingManager( } private fun invokeCoreKaptMethod(methodName: String, vararg args: Any): Any { - val array = arrayOfNulls>(args.size()) + val array = arrayOfNulls>(args.size) args.forEachIndexed { i, arg -> array[i] = arg.javaClass } val method = getCoreKaptPackageClass().getMethod(methodName, *array) return method.invoke(null, *args) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/FinishBuildListener.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/FinishBuildListener.kt index f3c9eef8df1..4979d77a8c0 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/FinishBuildListener.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/FinishBuildListener.kt @@ -36,7 +36,7 @@ private fun comparableVersionStr(version: String) = ?.groups ?.drop(1)?.take(2) // checking if two subexpression groups are found and length of each is >0 and <4 - ?.let { if (it.all { (it?.value?.length() ?: 0).let { it > 0 && it < 4 }}) it else null } + ?.let { if (it.all { (it?.value?.length ?: 0).let { it > 0 && it < 4 }}) it else null } ?.joinToString(".", transform = { it!!.value.padStart(3, '0') }) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt index c47bbda799c..c21346c86e7 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt @@ -157,7 +157,7 @@ class Kotlin2JvmSourceSetProcessor( val subpluginEnvironment = loadSubplugins(project) subpluginEnvironment.addSubpluginArguments(project, kotlinTask) - if (aptConfiguration.getDependencies().size() > 1 && javaTask is JavaCompile) { + if (aptConfiguration.getDependencies().size > 1 && javaTask is JavaCompile) { val (aptOutputDir, aptWorkingDir) = project.getAptDirsForSourceSet(sourceSetName) val kaptManager = AnnotationProcessingManager(kotlinTask, javaTask, sourceSetName, @@ -389,7 +389,7 @@ open class KotlinAndroidPlugin @Inject constructor(val scriptHandler: ScriptHand val aptConfiguration = aptConfigurations[(provider as AndroidSourceSet).getName()] // Ignore if there's only an annotation processor wrapper in dependencies (added by default) - if (aptConfiguration != null && aptConfiguration.getDependencies().size() > 1) { + if (aptConfiguration != null && aptConfiguration.getDependencies().size > 1) { aptFiles.addAll(aptConfiguration.resolve()) } } @@ -598,7 +598,7 @@ private fun compareVersionNumbers(v1: String?, v2: String?): Int { val part2 = v2.split(pattern) var idx = 0 - while (idx < part1.size() && idx < part2.size()) { + while (idx < part1.size && idx < part2.size) { val p1 = part1[idx] val p2 = part2[idx] @@ -612,13 +612,13 @@ private fun compareVersionNumbers(v1: String?, v2: String?): Int { idx++ } - if (part1.size() == part2.size()) { + if (part1.size == part2.size) { return 0 } else { - val left = part1.size() > idx + val left = part1.size > idx val parts = if (left) part1 else part2 - while (idx < parts.size()) { + while (idx < parts.size) { val p = parts[idx] val cmp: Int if (p.matches(digitsPattern)) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt b/libraries/tools/kotlin-gradle-plugin/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt index c6f5a1968e8..f5f2b8ccef5 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt @@ -65,7 +65,7 @@ class KotlinGradleIT: BaseGradleIT() { project.build(userVariantArg, "build", options = BaseGradleIT.BuildOptions(withDaemon = true)) { assertSuccessful() val matches = "\\[PERF\\] Used memory after build: (\\d+) kb \\(([+-]?\\d+) kb\\)".toRegex().find(output) - assert(matches != null && matches.groups.size() == 3) { "Used memory after build is not reported by plugin" } + assert(matches != null && matches.groups.size == 3) { "Used memory after build is not reported by plugin" } val reportedGrowth = matches!!.groups.get(2)!!.value.removePrefix("+").toInt() assert(reportedGrowth <= 700) { "Used memory growth $reportedGrowth > 700" } } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt index 28aed9c6d1f..9ac33b7b07b 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt @@ -106,10 +106,10 @@ fun aggregates(): List { deprecate(Strings) { forBinaryCompatibility } doc(CharSequences) { "Returns the length of this char sequence."} body(CharSequences, Strings) { - "return length()" + "return length" } body(Maps, Collections, ArraysOfObjects, ArraysOfPrimitives) { - "return size()" + "return size" } } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt index 5d1a43bd98b..d2b2d6f7e25 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt @@ -10,7 +10,7 @@ fun arrays(): List { doc { "Returns `true` if the array is empty." } returns("Boolean") body { - "return size() == 0" + "return size == 0" } } @@ -41,7 +41,7 @@ fun arrays(): List { doc { "Returns the last valid index for the array." } returns("Int") body { - "get() = size() - 1" + "get() = size - 1" } } @@ -65,7 +65,7 @@ fun arrays(): List { // TODO: Use different implementations for JS body { """ - val result = $arrayType(size()) + val result = $arrayType(size) for (index in indices) result[index] = this[index] return result @@ -73,7 +73,7 @@ fun arrays(): List { } body(Collections) { """ - val result = $arrayType(size()) + val result = $arrayType(size) var index = 0 for (element in this) result[index++] = element diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt index 2851e9bc68f..5b7c9ea7872 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt @@ -577,7 +577,7 @@ fun elements(): List { body { """ when (this) { - is List -> return if (isEmpty()) null else this[size() - 1] + is List -> return if (isEmpty()) null else this[size - 1] else -> { val iterator = iterator() if (!iterator.hasNext()) @@ -604,12 +604,12 @@ fun elements(): List { deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { """ - return if (isEmpty()) null else this[length() - 1] + return if (isEmpty()) null else this[length - 1] """ } body(Lists, ArraysOfObjects, ArraysOfPrimitives) { """ - return if (isEmpty()) null else this[size() - 1] + return if (isEmpty()) null else this[size - 1] """ } } @@ -704,7 +704,7 @@ fun elements(): List { body { """ when (this) { - is List -> return when (size()) { + is List -> return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -735,7 +735,7 @@ fun elements(): List { deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { """ - return when (length()) { + return when (length) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -744,7 +744,7 @@ fun elements(): List { } body(Lists, ArraysOfObjects, ArraysOfPrimitives) { """ - return when (size()) { + return when (size) { 0 -> throw NoSuchElementException("Collection is empty.") 1 -> this[0] else -> throw IllegalArgumentException("Collection has more than one element.") @@ -759,7 +759,7 @@ fun elements(): List { body { """ when (this) { - is List -> return if (size() == 1) this[0] else null + is List -> return if (size == 1) this[0] else null else -> { val iterator = iterator() if (!iterator.hasNext()) @@ -786,12 +786,12 @@ fun elements(): List { deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { """ - return if (length() == 1) this[0] else null + return if (length == 1) this[0] else null """ } body(Lists, ArraysOfObjects, ArraysOfPrimitives) { """ - return if (size() == 1) this[0] else null + return if (size == 1) this[0] else null """ } } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt index 857f471e605..04fae2f0982 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt @@ -30,13 +30,13 @@ fun filtering(): List { if (n == 0) return toList() val list: ArrayList if (this is Collection<*>) { - val resultSize = size() - n + val resultSize = size - n if (resultSize <= 0) return emptyList() list = ArrayList(resultSize) if (this is List) { - for (index in n..size() - 1) { + for (index in n..size - 1) { list.add(this[index]) } return list @@ -77,11 +77,11 @@ fun filtering(): List { require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return toList() - if (n >= size()) + if (n >= size) return emptyList() - val list = ArrayList(size() - n) - for (index in n..size() - 1) { + val list = ArrayList(size - n) + for (index in n..size - 1) { list.add(this[index]) } return list @@ -97,7 +97,7 @@ fun filtering(): List { """ require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - if (this is Collection && n >= size()) return toList() + if (this is Collection && n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -132,7 +132,7 @@ fun filtering(): List { """ require(n >= 0) { "Requested element count $n is less than zero." } if (n == 0) return emptyList() - if (n >= size()) return toList() + if (n >= size) return toList() var count = 0 val list = ArrayList(n) for (item in this) { @@ -154,7 +154,7 @@ fun filtering(): List { body { """ require(n >= 0, { "Requested element count $n is less than zero." }) - return take((size() - n).coerceAtLeast(0)) + return take((size - n).coerceAtLeast(0)) """ } @@ -192,7 +192,7 @@ fun filtering(): List { """ require(n >= 0, { "Requested element count $n is less than zero." }) if (n == 0) return emptyList() - val size = size() + val size = size if (n >= size) return toList() val list = ArrayList(n) for (index in size - n .. size - 1) @@ -390,7 +390,7 @@ fun filtering(): List { deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { """ - for (index in 0..length() - 1) { + for (index in 0..length - 1) { val element = get(index) if (predicate(element)) destination.append(element) } @@ -593,7 +593,7 @@ fun filtering(): List { returns("SELF") body(ArraysOfObjects) { """ - val result = arrayOfNulls(this, indices.size()) as Array + val result = arrayOfNulls(this, indices.size) as Array var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] @@ -603,7 +603,7 @@ fun filtering(): List { } body(ArraysOfPrimitives) { """ - val result = SELF(indices.size()) + val result = SELF(indices.size) var targetIndex = 0 for (sourceIndex in indices) { result[targetIndex++] = this[sourceIndex] diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt index 04700cb3c64..bb44404e06f 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Generators.kt @@ -23,7 +23,7 @@ fun generators(): List { } body(Collections) { """ - val result = ArrayList(size() + 1) + val result = ArrayList(size + 1) result.addAll(this) result.add(element) return result @@ -36,7 +36,7 @@ fun generators(): List { doc(Sets) { "Returns a set containing all elements of the original set and then the given [element]." } body(Sets) { """ - val result = LinkedHashSet(mapCapacity(size() + 1)) + val result = LinkedHashSet(mapCapacity(size + 1)) result.addAll(this) result.add(element) return result @@ -70,7 +70,7 @@ fun generators(): List { body(Collections) { """ if (collection is Collection) { - val result = ArrayList(this.size() + collection.size()) + val result = ArrayList(this.size + collection.size) result.addAll(this) result.addAll(collection) return result @@ -86,7 +86,7 @@ fun generators(): List { doc(Sets) { "Returns a set containing all elements both of the original set and the given [collection]." } body(Sets) { """ - val result = LinkedHashSet(mapCapacity(collection.collectionSizeOrNull()?.let { this.size() + it } ?: this.size() * 2)) + val result = LinkedHashSet(mapCapacity(collection.collectionSizeOrNull()?.let { this.size + it } ?: this.size * 2)) result.addAll(this) result.addAll(collection) return result @@ -126,7 +126,7 @@ fun generators(): List { } body(Collections) { """ - val result = ArrayList(this.size() + array.size()) + val result = ArrayList(this.size + array.size) result.addAll(this) result.addAll(array) return result @@ -135,7 +135,7 @@ fun generators(): List { doc(Sets) { "Returns a set containing all elements both of the original set and the given [array]." } body(Sets) { """ - val result = LinkedHashSet(mapCapacity(this.size() + array.size())) + val result = LinkedHashSet(mapCapacity(this.size + array.size)) result.addAll(this) result.addAll(array) return result @@ -174,7 +174,7 @@ fun generators(): List { } body(Collections) { """ - val result = ArrayList(this.size() + 10) + val result = ArrayList(this.size + 10) result.addAll(this) result.addAll(sequence) return result @@ -185,7 +185,7 @@ fun generators(): List { doc(Sets) { "Returns a set containing all elements both of the original set and the given [sequence]." } body(Sets) { """ - val result = LinkedHashSet(mapCapacity(this.size() * 2)) + val result = LinkedHashSet(mapCapacity(this.size * 2)) result.addAll(this) result.addAll(sequence) return result @@ -225,7 +225,7 @@ fun generators(): List { doc(Sets) { "Returns a set containing all elements of the original set except the given [element]." } body(Sets) { """ - val result = LinkedHashSet(mapCapacity(size())) + val result = LinkedHashSet(mapCapacity(size)) var removed = false return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true } """ @@ -469,7 +469,7 @@ fun generators(): List { } body(ArraysOfObjects, ArraysOfPrimitives) { """ - val arraySize = size() + val arraySize = size val list = ArrayList(Math.min(other.collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in other) { @@ -494,7 +494,7 @@ fun generators(): List { inline(true) body { """ - val arraySize = array.size() + val arraySize = array.size val list = ArrayList(Math.min(collectionSizeOrDefault(10), arraySize)) var i = 0 for (element in this) { @@ -506,7 +506,7 @@ fun generators(): List { } body(ArraysOfObjects, ArraysOfPrimitives) { """ - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -529,7 +529,7 @@ fun generators(): List { inline(true) body() { """ - val size = Math.min(size(), array.size()) + val size = Math.min(size, array.size) val list = ArrayList(size) for (i in 0..size-1) { list.add(transform(this[i], array[i])) @@ -569,7 +569,7 @@ fun generators(): List { inline(true) body { """ - val length = Math.min(this.length(), other.length()) + val length = Math.min(this.length, other.length) val list = ArrayList(length) for (i in 0..length-1) { diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt index e00d6bcd63f..0580bd81b94 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt @@ -42,11 +42,11 @@ fun mapping(): List { "return mapIndexedTo(ArrayList(collectionSizeOrDefault(10)), transform)" } body(ArraysOfObjects, ArraysOfPrimitives) { - "return mapIndexedTo(ArrayList(size()), transform)" + "return mapIndexedTo(ArrayList(size), transform)" } deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { - "return mapIndexedTo(ArrayList(length()), transform)" + "return mapIndexedTo(ArrayList(length), transform)" } inline(false, Sequences) returns(Sequences) { "Sequence" } @@ -70,11 +70,11 @@ fun mapping(): List { "return mapTo(ArrayList(collectionSizeOrDefault(10)), transform)" } body(ArraysOfObjects, ArraysOfPrimitives, Maps) { - "return mapTo(ArrayList(size()), transform)" + "return mapTo(ArrayList(size), transform)" } deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { - "return mapTo(ArrayList(length()), transform)" + "return mapTo(ArrayList(length), transform)" } inline(false, Sequences) diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Ordering.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Ordering.kt index 03094595287..cb54c9d4378 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Ordering.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Ordering.kt @@ -68,7 +68,7 @@ fun ordering(): List { body(ArraysOfObjects) { """ if (isEmpty()) return this - val result = arrayOfNulls(this, size()) as Array + val result = arrayOfNulls(this, size) as Array val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] @@ -78,7 +78,7 @@ fun ordering(): List { body(ArraysOfPrimitives) { """ if (isEmpty()) return this - val result = SELF(size()) + val result = SELF(size) val lastIndex = lastIndex for (i in 0..lastIndex) result[lastIndex - i] = this[i] diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt index d2201bb71e5..4cc8ce763d4 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Sets.kt @@ -22,7 +22,7 @@ fun sets(): List { } body(ArraysOfObjects, ArraysOfPrimitives) { """ - val set = LinkedHashSet(mapCapacity(size())) + val set = LinkedHashSet(mapCapacity(size)) for (item in this) set.add(item) return set """ diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt index 493153eb17a..db655c257ec 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt @@ -29,8 +29,8 @@ fun snapshots(): List { body { "return toCollection(LinkedHashSet(mapCapacity(collectionSizeOrDefault(12))))" } body(Sequences) { "return toCollection(LinkedHashSet())" } deprecate(Strings) { forBinaryCompatibility } - body(CharSequences, Strings) { "return toCollection(LinkedHashSet(mapCapacity(length())))" } - body(ArraysOfObjects, ArraysOfPrimitives) { "return toCollection(LinkedHashSet(mapCapacity(size())))" } + body(CharSequences, Strings) { "return toCollection(LinkedHashSet(mapCapacity(length)))" } + body(ArraysOfObjects, ArraysOfPrimitives) { "return toCollection(LinkedHashSet(mapCapacity(size)))" } } templates add f("toHashSet()") { @@ -39,8 +39,8 @@ fun snapshots(): List { body { "return toCollection(HashSet(mapCapacity(collectionSizeOrDefault(12))))" } body(Sequences) { "return toCollection(HashSet())" } deprecate(Strings) { forBinaryCompatibility } - body(CharSequences, Strings) { "return toCollection(HashSet(mapCapacity(length())))" } - body(ArraysOfObjects, ArraysOfPrimitives) { "return toCollection(HashSet(mapCapacity(size())))" } + body(CharSequences, Strings) { "return toCollection(HashSet(mapCapacity(length)))" } + body(ArraysOfObjects, ArraysOfPrimitives) { "return toCollection(HashSet(mapCapacity(size)))" } } templates add f("toSortedSet()") { @@ -64,11 +64,11 @@ fun snapshots(): List { } body(Collections) { "return ArrayList(this)" } deprecate(Strings) { forBinaryCompatibility } - body(CharSequences, Strings) { "return toCollection(ArrayList(length()))" } + body(CharSequences, Strings) { "return toCollection(ArrayList(length))" } body(ArraysOfObjects) { "return ArrayList(this.asCollection())" } body(ArraysOfPrimitives) { """ - val list = ArrayList(size()) + val list = ArrayList(size) for (item in this) list.add(item) return list """ @@ -81,7 +81,7 @@ fun snapshots(): List { returns("List>") body { """ - val result = ArrayList>(size()) + val result = ArrayList>(size) for (item in this) result.add(item.key to item.value) return result @@ -153,7 +153,7 @@ fun snapshots(): List { deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { """ - val capacity = (length()/.75f) + 1 + val capacity = (length/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -163,7 +163,7 @@ fun snapshots(): List { } body(ArraysOfObjects, ArraysOfPrimitives) { """ - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), element) @@ -212,7 +212,7 @@ fun snapshots(): List { deprecate(Strings) { forBinaryCompatibility } body(CharSequences, Strings) { """ - val capacity = (length()/.75f) + 1 + val capacity = (length/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) @@ -222,7 +222,7 @@ fun snapshots(): List { } body(ArraysOfObjects, ArraysOfPrimitives) { """ - val capacity = (size()/.75f) + 1 + val capacity = (size/.75f) + 1 val result = LinkedHashMap(Math.max(capacity.toInt(), 16)) for (element in this) { result.put(selector(element), transform(element)) diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt index fe1d72eed70..69b7e014278 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt @@ -13,7 +13,7 @@ fun specialJVM(): List { doc { "Returns an array containing all elements of the original array and then the given [element]." } body() { """ - val index = size() + val index = size val result = Arrays.copyOf(this, index + 1) result[index] = element return result @@ -29,8 +29,8 @@ fun specialJVM(): List { doc { "Returns an array containing all elements of the original array and then all elements of the given [collection]." } body { """ - var index = size() - val result = Arrays.copyOf(this, index + collection.size()) + var index = size + val result = Arrays.copyOf(this, index + collection.size) for (element in collection) result[index++] = element return result """ @@ -46,8 +46,8 @@ fun specialJVM(): List { returns("SELF") body { """ - val thisSize = size() - val arraySize = array.size() + val thisSize = size + val arraySize = array.size val result = Arrays.copyOf(this, thisSize + arraySize) System.arraycopy(array, 0, result, thisSize, arraySize) return result @@ -72,7 +72,7 @@ fun specialJVM(): List { returns("SELF") annotations(InvariantArraysOfObjects) { """@JvmName("mutableCopyOf")"""} body { - "return Arrays.copyOf(this, size())" + "return Arrays.copyOf(this, size)" } } @@ -89,7 +89,7 @@ fun specialJVM(): List { annotations(InvariantArraysOfObjects) { """@JvmName("mutableCopyOf")"""} } - templates add f("fill(element: T, fromIndex: Int = 0, toIndex: Int = size())") { + templates add f("fill(element: T, fromIndex: Int = 0, toIndex: Int = size)") { only(InvariantArraysOfObjects, ArraysOfPrimitives) doc { "Fills original array with the provided value." } returns { "Unit" } @@ -100,7 +100,7 @@ fun specialJVM(): List { } } - templates add f("binarySearch(element: T, fromIndex: Int = 0, toIndex: Int = size())") { + templates add f("binarySearch(element: T, fromIndex: Int = 0, toIndex: Int = size)") { only(ArraysOfObjects, ArraysOfPrimitives) exclude(PrimitiveType.Boolean) doc { "Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted." } @@ -110,7 +110,7 @@ fun specialJVM(): List { } } - templates add f("binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size())") { + templates add f("binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size)") { only(ArraysOfObjects) doc { "Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted according to the specified [comparator]." } returns("Int") @@ -130,7 +130,7 @@ fun specialJVM(): List { } } - templates add f("sort(fromIndex: Int = 0, toIndex: Int = size())") { + templates add f("sort(fromIndex: Int = 0, toIndex: Int = size)") { only(ArraysOfObjects, ArraysOfPrimitives) exclude(PrimitiveType.Boolean) doc { "Sorts a range in the array in-place." } @@ -149,7 +149,7 @@ fun specialJVM(): List { } } - templates add f("sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size())") { + templates add f("sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size)") { only(ArraysOfObjects) doc { "Sorts a range in the array in-place with the given [comparator]." } returns("Unit") @@ -247,7 +247,7 @@ fun specialJVM(): List { body(ArraysOfPrimitives) { """ return object : AbstractList(), RandomAccess { - override val size: Int get() = this@asList.size() + override val size: Int get() = this@asList.size override fun isEmpty(): Boolean = this@asList.isEmpty() override fun contains(o: T): Boolean = this@asList.contains(o) override fun get(index: Int): T = this@asList[index] @@ -268,7 +268,7 @@ fun specialJVM(): List { } body { """ - val result = arrayOfNulls(size()) + val result = arrayOfNulls(size) for (index in indices) result[index] = this[index] return result as Array