From 8b749084b5eb806cc820aa557984c33c6d77e2b7 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 4 Sep 2012 16:52:43 +0400 Subject: [PATCH] library changes after collections mapping --- .../src/generated/ArraysFromJLangIterables.kt | 20 ++++++------- .../generated/ArraysFromJLangIterablesJVM.kt | 2 +- .../generated/ArraysFromJLangIterablesLazy.kt | 4 +-- .../generated/ArraysFromJUtilCollections.kt | 4 +-- .../ArraysFromJUtilCollectionsJVM.kt | 4 +-- .../BooleanArraysFromJLangIterables.kt | 20 ++++++------- .../BooleanArraysFromJLangIterablesJVM.kt | 2 +- .../BooleanArraysFromJLangIterablesLazy.kt | 4 +-- .../BooleanArraysFromJUtilCollections.kt | 4 +-- .../BooleanArraysFromJUtilCollectionsJVM.kt | 4 +-- .../generated/ByteArraysFromJLangIterables.kt | 20 ++++++------- .../ByteArraysFromJLangIterablesJVM.kt | 2 +- .../ByteArraysFromJLangIterablesLazy.kt | 4 +-- .../ByteArraysFromJUtilCollections.kt | 4 +-- .../ByteArraysFromJUtilCollectionsJVM.kt | 4 +-- .../generated/CharArraysFromJLangIterables.kt | 20 ++++++------- .../CharArraysFromJLangIterablesJVM.kt | 2 +- .../CharArraysFromJLangIterablesLazy.kt | 4 +-- .../CharArraysFromJUtilCollections.kt | 4 +-- .../CharArraysFromJUtilCollectionsJVM.kt | 4 +-- .../DoubleArraysFromJLangIterables.kt | 20 ++++++------- .../DoubleArraysFromJLangIterablesJVM.kt | 2 +- .../DoubleArraysFromJLangIterablesLazy.kt | 4 +-- .../DoubleArraysFromJUtilCollections.kt | 4 +-- .../DoubleArraysFromJUtilCollectionsJVM.kt | 4 +-- .../FloatArraysFromJLangIterables.kt | 20 ++++++------- .../FloatArraysFromJLangIterablesJVM.kt | 2 +- .../FloatArraysFromJLangIterablesLazy.kt | 4 +-- .../FloatArraysFromJUtilCollections.kt | 4 +-- .../FloatArraysFromJUtilCollectionsJVM.kt | 4 +-- .../generated/IntArraysFromJLangIterables.kt | 20 ++++++------- .../IntArraysFromJLangIterablesJVM.kt | 2 +- .../IntArraysFromJLangIterablesLazy.kt | 4 +-- .../IntArraysFromJUtilCollections.kt | 4 +-- .../IntArraysFromJUtilCollectionsJVM.kt | 4 +-- .../JUtilIteratorsFromJLangIterables.kt | 20 ++++++------- .../JUtilIteratorsFromJLangIterablesJVM.kt | 2 +- .../generated/LongArraysFromJLangIterables.kt | 20 ++++++------- .../LongArraysFromJLangIterablesJVM.kt | 2 +- .../LongArraysFromJLangIterablesLazy.kt | 4 +-- .../LongArraysFromJUtilCollections.kt | 4 +-- .../LongArraysFromJUtilCollectionsJVM.kt | 4 +-- .../ShortArraysFromJLangIterables.kt | 20 ++++++------- .../ShortArraysFromJLangIterablesJVM.kt | 2 +- .../ShortArraysFromJLangIterablesLazy.kt | 4 +-- .../ShortArraysFromJUtilCollections.kt | 4 +-- .../ShortArraysFromJUtilCollectionsJVM.kt | 4 +-- .../generated/StandardFromJUtilCollections.kt | 4 +-- .../StandardFromJUtilCollectionsJVM.kt | 4 +-- .../stdlib/src/kotlin/ImmutableArrayList.kt | 5 ++-- libraries/stdlib/src/kotlin/JLangIterables.kt | 18 ++++++------ .../stdlib/src/kotlin/JLangIterablesLazy.kt | 2 -- .../src/kotlin/JLangIterablesSpecial.kt | 6 ++-- .../src/kotlin/JLangIterablesSpecialJVM.kt | 5 +--- libraries/stdlib/src/kotlin/JUtil.kt | 10 +++---- .../stdlib/src/kotlin/JUtilCollections.kt | 2 +- .../stdlib/src/kotlin/JUtilCollectionsJVM.kt | 2 +- libraries/stdlib/src/kotlin/JUtilJVM.kt | 4 +-- libraries/stdlib/src/kotlin/JUtilMaps.kt | 28 ++++++++----------- libraries/stdlib/src/kotlin/JUtilMapsJVM.kt | 13 ++++----- libraries/stdlib/src/kotlin/Standard.kt | 1 - libraries/stdlib/src/kotlin/StandardJVM.kt | 1 - libraries/stdlib/src/kotlin/Strings.kt | 1 - libraries/stdlib/src/kotlin/StringsJVM.kt | 1 - libraries/stdlib/src/kotlin/dom/DomJVM.kt | 2 +- libraries/stdlib/src/kotlin/io/Files.kt | 1 - .../src/kotlin/modules/ModuleBuilder.kt | 6 ++-- .../stdlib/src/kotlin/nullable/Nullables.kt | 16 +++++------ .../src/kotlin/properties/Properties.kt | 8 ++---- .../stdlib/test/ImmutableArrayListTest.kt | 1 - libraries/stdlib/test/StdLibIssuesTest.kt | 1 - .../kotlin/tools/GenerateJavaScriptStubs.kt | 1 - .../kotlin/tools/GenerateStandardLib.kt | 17 ++++++----- .../stdlib/test/regressions/Kt1617Test.kt | 1 - .../stdlib/test/regressions/Kt1619Test.kt | 1 - 75 files changed, 222 insertions(+), 268 deletions(-) diff --git a/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt index 4ad6e01a556..2c838038917 100644 --- a/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun Array.find(predicate: (T) -> Boolean) : T? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > Array.filterTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Array.filterTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > Array.filterTo(result: C, predicat * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > Array.filterNotTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Array.filterNotTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > Array.filterNotTo(result: C, predi * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > Array?.filterNotNullTo(result: C) : C { +public inline fun > Array?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > Array?.filterNotNullTo(result: C) * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun Array.flatMapTo(result: Collection, transform: (T) -> Collection) : Collection { +public inline fun Array.flatMapTo(result: MutableCollection, transform: (T) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun Array.reduceRight(operation: (T, T) -> T): T = reverse( * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun Array.groupBy(toKey: (T) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun Array.groupBy(toKey: (T) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun Array.groupByTo(result: Map>, toKey: (T) -> K) : Map> { +public inline fun Array.groupByTo(result: MutableMap>, toKey: (T) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun Array.makeString(separator: String = ", ", prefix: Stri } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > Array.dropWhileTo(result: L, predicate: (T) -> Boolean) : L { +public inline fun > Array.dropWhileTo(result: L, predicate: (T) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > Array.dropWhileTo(result: L, predicate: } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > Array.takeWhileTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Array.takeWhileTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > Array.toCollection(result: C) : C { +public inline fun > Array.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/ArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/ArraysFromJLangIterablesJVM.kt index 9b6d60ff6aa..b77fca7de56 100644 --- a/libraries/stdlib/src/generated/ArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/ArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/ArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/ArraysFromJLangIterablesLazy.kt index 6a5fd05a52d..8a56a6e79f2 100644 --- a/libraries/stdlib/src/generated/ArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/ArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/ArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/ArraysFromJUtilCollections.kt index 654f8cfd992..ce5419a2870 100644 --- a/libraries/stdlib/src/generated/ArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/ArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > Array.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > Array.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/ArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/ArraysFromJUtilCollectionsJVM.kt index cc14f9f97a2..f7bd6a7d32d 100644 --- a/libraries/stdlib/src/generated/ArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/ArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun Array.map(transform : (T) -> R) : java.util.List { +public inline fun Array.map(transform : (T) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt index 0ec278cc00d..d47ec3525bb 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun BooleanArray.find(predicate: (Boolean) -> Boolean) : Boolean? * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > BooleanArray.filterTo(result: C, predicate: (Boolean) -> Boolean) : C { +public inline fun > BooleanArray.filterTo(result: C, predicate: (Boolean) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > BooleanArray.filterTo(result: C, pred * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > BooleanArray.filterNotTo(result: C, predicate: (Boolean) -> Boolean) : C { +public inline fun > BooleanArray.filterNotTo(result: C, predicate: (Boolean) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > BooleanArray.filterNotTo(result: C, p * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > BooleanArray?.filterNotNullTo(result: C) : C { +public inline fun > BooleanArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > BooleanArray?.filterNotNullTo(result: * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun BooleanArray.flatMapTo(result: Collection, transform: (Boolean) -> Collection) : Collection { +public inline fun BooleanArray.flatMapTo(result: MutableCollection, transform: (Boolean) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun BooleanArray.reduceRight(operation: (Boolean, Boolean) -> Bool * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun BooleanArray.groupBy(toKey: (Boolean) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun BooleanArray.groupBy(toKey: (Boolean) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun BooleanArray.groupByTo(result: Map>, toKey: (Boolean) -> K) : Map> { +public inline fun BooleanArray.groupByTo(result: MutableMap>, toKey: (Boolean) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun BooleanArray.makeString(separator: String = ", ", prefix: Stri } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > BooleanArray.dropWhileTo(result: L, predicate: (Boolean) -> Boolean) : L { +public inline fun > BooleanArray.dropWhileTo(result: L, predicate: (Boolean) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > BooleanArray.dropWhileTo(result: L, predica } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > BooleanArray.takeWhileTo(result: C, predicate: (Boolean) -> Boolean) : C { +public inline fun > BooleanArray.takeWhileTo(result: C, predicate: (Boolean) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > BooleanArray.toCollection(result: C) : C { +public inline fun > BooleanArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesJVM.kt index f46d1cc4214..72bc5398263 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesLazy.kt index ea05ed38721..7ef7f6a4656 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollections.kt index b65dac40c20..f6a940d8251 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > BooleanArray.mapTo(result: C, transform : (Boolean) -> R) : C { +public inline fun > BooleanArray.mapTo(result: C, transform : (Boolean) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollectionsJVM.kt index 8bd41f7208d..426f8417b04 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun BooleanArray.map(transform : (Boolean) -> R) : java.util.List { +public inline fun BooleanArray.map(transform : (Boolean) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt index 26c401006fa..3eae7ff6e67 100644 --- a/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun ByteArray.find(predicate: (Byte) -> Boolean) : Byte? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > ByteArray.filterTo(result: C, predicate: (Byte) -> Boolean) : C { +public inline fun > ByteArray.filterTo(result: C, predicate: (Byte) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > ByteArray.filterTo(result: C, predicate: * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > ByteArray.filterNotTo(result: C, predicate: (Byte) -> Boolean) : C { +public inline fun > ByteArray.filterNotTo(result: C, predicate: (Byte) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > ByteArray.filterNotTo(result: C, predica * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > ByteArray?.filterNotNullTo(result: C) : C { +public inline fun > ByteArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > ByteArray?.filterNotNullTo(result: C) : * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun ByteArray.flatMapTo(result: Collection, transform: (Byte) -> Collection) : Collection { +public inline fun ByteArray.flatMapTo(result: MutableCollection, transform: (Byte) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun ByteArray.reduceRight(operation: (Byte, Byte) -> Byte): Byte = * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun ByteArray.groupBy(toKey: (Byte) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun ByteArray.groupBy(toKey: (Byte) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun ByteArray.groupByTo(result: Map>, toKey: (Byte) -> K) : Map> { +public inline fun ByteArray.groupByTo(result: MutableMap>, toKey: (Byte) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun ByteArray.makeString(separator: String = ", ", prefix: String } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > ByteArray.dropWhileTo(result: L, predicate: (Byte) -> Boolean) : L { +public inline fun > ByteArray.dropWhileTo(result: L, predicate: (Byte) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > ByteArray.dropWhileTo(result: L, predicate: (B } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > ByteArray.takeWhileTo(result: C, predicate: (Byte) -> Boolean) : C { +public inline fun > ByteArray.takeWhileTo(result: C, predicate: (Byte) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > ByteArray.toCollection(result: C) : C { +public inline fun > ByteArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesJVM.kt index 0abc222ae9b..9aedbe3118a 100644 --- a/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesLazy.kt index c819c1f0d19..ae01dfc0ba5 100644 --- a/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/ByteArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/ByteArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/ByteArraysFromJUtilCollections.kt index 16f54544c71..cdd0f301373 100644 --- a/libraries/stdlib/src/generated/ByteArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/ByteArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > ByteArray.mapTo(result: C, transform : (Byte) -> R) : C { +public inline fun > ByteArray.mapTo(result: C, transform : (Byte) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/ByteArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/ByteArraysFromJUtilCollectionsJVM.kt index fa2a6c33f6f..f3c16749fc1 100644 --- a/libraries/stdlib/src/generated/ByteArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/ByteArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun ByteArray.map(transform : (Byte) -> R) : java.util.List { +public inline fun ByteArray.map(transform : (Byte) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt index 59ee1397e0b..bd6234105e9 100644 --- a/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun CharArray.find(predicate: (Char) -> Boolean) : Char? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > CharArray.filterTo(result: C, predicate: (Char) -> Boolean) : C { +public inline fun > CharArray.filterTo(result: C, predicate: (Char) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > CharArray.filterTo(result: C, predicate: * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > CharArray.filterNotTo(result: C, predicate: (Char) -> Boolean) : C { +public inline fun > CharArray.filterNotTo(result: C, predicate: (Char) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > CharArray.filterNotTo(result: C, predica * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > CharArray?.filterNotNullTo(result: C) : C { +public inline fun > CharArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > CharArray?.filterNotNullTo(result: C) : * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun CharArray.flatMapTo(result: Collection, transform: (Char) -> Collection) : Collection { +public inline fun CharArray.flatMapTo(result: MutableCollection, transform: (Char) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun CharArray.reduceRight(operation: (Char, Char) -> Char): Char = * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun CharArray.groupBy(toKey: (Char) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun CharArray.groupBy(toKey: (Char) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun CharArray.groupByTo(result: Map>, toKey: (Char) -> K) : Map> { +public inline fun CharArray.groupByTo(result: MutableMap>, toKey: (Char) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun CharArray.makeString(separator: String = ", ", prefix: String } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > CharArray.dropWhileTo(result: L, predicate: (Char) -> Boolean) : L { +public inline fun > CharArray.dropWhileTo(result: L, predicate: (Char) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > CharArray.dropWhileTo(result: L, predicate: (C } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > CharArray.takeWhileTo(result: C, predicate: (Char) -> Boolean) : C { +public inline fun > CharArray.takeWhileTo(result: C, predicate: (Char) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > CharArray.toCollection(result: C) : C { +public inline fun > CharArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/CharArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/CharArraysFromJLangIterablesJVM.kt index 9c6027558ba..43b6b8a5b2f 100644 --- a/libraries/stdlib/src/generated/CharArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/CharArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/CharArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/CharArraysFromJLangIterablesLazy.kt index ddc3a784194..26cd5ffd3b2 100644 --- a/libraries/stdlib/src/generated/CharArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/CharArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/CharArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/CharArraysFromJUtilCollections.kt index 4a107455085..e91ceceb4ea 100644 --- a/libraries/stdlib/src/generated/CharArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/CharArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > CharArray.mapTo(result: C, transform : (Char) -> R) : C { +public inline fun > CharArray.mapTo(result: C, transform : (Char) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/CharArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/CharArraysFromJUtilCollectionsJVM.kt index 9e4bbd398e2..a05f3de8020 100644 --- a/libraries/stdlib/src/generated/CharArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/CharArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun CharArray.map(transform : (Char) -> R) : java.util.List { +public inline fun CharArray.map(transform : (Char) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt index 0871d26d1c2..89e49a0816e 100644 --- a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun DoubleArray.find(predicate: (Double) -> Boolean) : Double? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > DoubleArray.filterTo(result: C, predicate: (Double) -> Boolean) : C { +public inline fun > DoubleArray.filterTo(result: C, predicate: (Double) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > DoubleArray.filterTo(result: C, predic * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > DoubleArray.filterNotTo(result: C, predicate: (Double) -> Boolean) : C { +public inline fun > DoubleArray.filterNotTo(result: C, predicate: (Double) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > DoubleArray.filterNotTo(result: C, pre * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > DoubleArray?.filterNotNullTo(result: C) : C { +public inline fun > DoubleArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > DoubleArray?.filterNotNullTo(result: C * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun DoubleArray.flatMapTo(result: Collection, transform: (Double) -> Collection) : Collection { +public inline fun DoubleArray.flatMapTo(result: MutableCollection, transform: (Double) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun DoubleArray.reduceRight(operation: (Double, Double) -> Double) * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun DoubleArray.groupBy(toKey: (Double) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun DoubleArray.groupBy(toKey: (Double) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun DoubleArray.groupByTo(result: Map>, toKey: (Double) -> K) : Map> { +public inline fun DoubleArray.groupByTo(result: MutableMap>, toKey: (Double) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun DoubleArray.makeString(separator: String = ", ", prefix: Strin } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > DoubleArray.dropWhileTo(result: L, predicate: (Double) -> Boolean) : L { +public inline fun > DoubleArray.dropWhileTo(result: L, predicate: (Double) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > DoubleArray.dropWhileTo(result: L, predicate } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > DoubleArray.takeWhileTo(result: C, predicate: (Double) -> Boolean) : C { +public inline fun > DoubleArray.takeWhileTo(result: C, predicate: (Double) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > DoubleArray.toCollection(result: C) : C { +public inline fun > DoubleArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesJVM.kt index 7a0fba09243..346b220387b 100644 --- a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesLazy.kt index f0d91ef916e..da0e6f18da6 100644 --- a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollections.kt index 87864c39ae6..1335f6e1022 100644 --- a/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > DoubleArray.mapTo(result: C, transform : (Double) -> R) : C { +public inline fun > DoubleArray.mapTo(result: C, transform : (Double) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollectionsJVM.kt index caeb0a150ca..4388fdfb039 100644 --- a/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/DoubleArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun DoubleArray.map(transform : (Double) -> R) : java.util.List { +public inline fun DoubleArray.map(transform : (Double) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt index 0605413783c..562f0883c72 100644 --- a/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun FloatArray.find(predicate: (Float) -> Boolean) : Float? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > FloatArray.filterTo(result: C, predicate: (Float) -> Boolean) : C { +public inline fun > FloatArray.filterTo(result: C, predicate: (Float) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > FloatArray.filterTo(result: C, predicat * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > FloatArray.filterNotTo(result: C, predicate: (Float) -> Boolean) : C { +public inline fun > FloatArray.filterNotTo(result: C, predicate: (Float) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > FloatArray.filterNotTo(result: C, predi * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > FloatArray?.filterNotNullTo(result: C) : C { +public inline fun > FloatArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > FloatArray?.filterNotNullTo(result: C) * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun FloatArray.flatMapTo(result: Collection, transform: (Float) -> Collection) : Collection { +public inline fun FloatArray.flatMapTo(result: MutableCollection, transform: (Float) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun FloatArray.reduceRight(operation: (Float, Float) -> Float): Fl * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun FloatArray.groupBy(toKey: (Float) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun FloatArray.groupBy(toKey: (Float) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun FloatArray.groupByTo(result: Map>, toKey: (Float) -> K) : Map> { +public inline fun FloatArray.groupByTo(result: MutableMap>, toKey: (Float) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun FloatArray.makeString(separator: String = ", ", prefix: String } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > FloatArray.dropWhileTo(result: L, predicate: (Float) -> Boolean) : L { +public inline fun > FloatArray.dropWhileTo(result: L, predicate: (Float) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > FloatArray.dropWhileTo(result: L, predicate: } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > FloatArray.takeWhileTo(result: C, predicate: (Float) -> Boolean) : C { +public inline fun > FloatArray.takeWhileTo(result: C, predicate: (Float) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > FloatArray.toCollection(result: C) : C { +public inline fun > FloatArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesJVM.kt index 154bac7ca94..3bb750f9b9b 100644 --- a/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesLazy.kt index fd57b86114c..f73719da3a3 100644 --- a/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/FloatArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/FloatArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/FloatArraysFromJUtilCollections.kt index 284cd9b55cb..1d8feeb82d2 100644 --- a/libraries/stdlib/src/generated/FloatArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/FloatArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > FloatArray.mapTo(result: C, transform : (Float) -> R) : C { +public inline fun > FloatArray.mapTo(result: C, transform : (Float) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/FloatArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/FloatArraysFromJUtilCollectionsJVM.kt index 62e33e5dbd6..104614fd31c 100644 --- a/libraries/stdlib/src/generated/FloatArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/FloatArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun FloatArray.map(transform : (Float) -> R) : java.util.List { +public inline fun FloatArray.map(transform : (Float) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt index d15333865b6..6a3e875b6c6 100644 --- a/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun IntArray.find(predicate: (Int) -> Boolean) : Int? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > IntArray.filterTo(result: C, predicate: (Int) -> Boolean) : C { +public inline fun > IntArray.filterTo(result: C, predicate: (Int) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > IntArray.filterTo(result: C, predicate: ( * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > IntArray.filterNotTo(result: C, predicate: (Int) -> Boolean) : C { +public inline fun > IntArray.filterNotTo(result: C, predicate: (Int) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > IntArray.filterNotTo(result: C, predicate * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > IntArray?.filterNotNullTo(result: C) : C { +public inline fun > IntArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > IntArray?.filterNotNullTo(result: C) : C * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun IntArray.flatMapTo(result: Collection, transform: (Int) -> Collection) : Collection { +public inline fun IntArray.flatMapTo(result: MutableCollection, transform: (Int) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun IntArray.reduceRight(operation: (Int, Int) -> Int): Int = reve * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun IntArray.groupBy(toKey: (Int) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun IntArray.groupBy(toKey: (Int) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun IntArray.groupByTo(result: Map>, toKey: (Int) -> K) : Map> { +public inline fun IntArray.groupByTo(result: MutableMap>, toKey: (Int) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun IntArray.makeString(separator: String = ", ", prefix: String = } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > IntArray.dropWhileTo(result: L, predicate: (Int) -> Boolean) : L { +public inline fun > IntArray.dropWhileTo(result: L, predicate: (Int) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > IntArray.dropWhileTo(result: L, predicate: (Int } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > IntArray.takeWhileTo(result: C, predicate: (Int) -> Boolean) : C { +public inline fun > IntArray.takeWhileTo(result: C, predicate: (Int) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > IntArray.toCollection(result: C) : C { +public inline fun > IntArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/IntArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/IntArraysFromJLangIterablesJVM.kt index eb938c89bfe..d1276a3bdf3 100644 --- a/libraries/stdlib/src/generated/IntArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/IntArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/IntArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/IntArraysFromJLangIterablesLazy.kt index 50ef61a5818..459ce7c5922 100644 --- a/libraries/stdlib/src/generated/IntArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/IntArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/IntArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/IntArraysFromJUtilCollections.kt index 97263c09444..66249d82b0c 100644 --- a/libraries/stdlib/src/generated/IntArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/IntArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > IntArray.mapTo(result: C, transform : (Int) -> R) : C { +public inline fun > IntArray.mapTo(result: C, transform : (Int) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/IntArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/IntArraysFromJUtilCollectionsJVM.kt index 7b5949e60bc..82bb4cad9fb 100644 --- a/libraries/stdlib/src/generated/IntArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/IntArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun IntArray.map(transform : (Int) -> R) : java.util.List { +public inline fun IntArray.map(transform : (Int) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt b/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt index 3fb7de475d7..87d8d482ea2 100644 --- a/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -78,7 +78,7 @@ public inline fun Iterator.find(predicate: (T) -> Boolean) : T? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > Iterator.filterTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Iterator.filterTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -88,7 +88,7 @@ public inline fun > Iterator.filterTo(result: C, predi * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > Iterator.filterNotTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Iterator.filterNotTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -98,7 +98,7 @@ public inline fun > Iterator.filterNotTo(result: C, pr * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > Iterator?.filterNotNullTo(result: C) : C { +public inline fun > Iterator?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -110,7 +110,7 @@ public inline fun > Iterator?.filterNotNullTo(result: * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun Iterator.flatMapTo(result: Collection, transform: (T) -> Collection) : Collection { +public inline fun Iterator.flatMapTo(result: MutableCollection, transform: (T) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -180,14 +180,14 @@ public inline fun Iterator.reduceRight(operation: (T, T) -> T): T = rever * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun Iterator.groupBy(toKey: (T) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun Iterator.groupBy(toKey: (T) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun Iterator.groupByTo(result: Map>, toKey: (T) -> K) : Map> { +public inline fun Iterator.groupByTo(result: MutableMap>, toKey: (T) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -211,7 +211,7 @@ public inline fun Iterator.makeString(separator: String = ", ", prefix: S } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > Iterator.dropWhileTo(result: L, predicate: (T) -> Boolean) : L { +public inline fun > Iterator.dropWhileTo(result: L, predicate: (T) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -225,13 +225,13 @@ public inline fun > Iterator.dropWhileTo(result: L, predicat } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > Iterator.takeWhileTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Iterator.takeWhileTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > Iterator.toCollection(result: C) : C { +public inline fun > Iterator.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterablesJVM.kt index 45563591d06..101ab31ef38 100644 --- a/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterablesJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt index 270a8454b68..c33df9dc3ea 100644 --- a/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun LongArray.find(predicate: (Long) -> Boolean) : Long? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > LongArray.filterTo(result: C, predicate: (Long) -> Boolean) : C { +public inline fun > LongArray.filterTo(result: C, predicate: (Long) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > LongArray.filterTo(result: C, predicate: * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > LongArray.filterNotTo(result: C, predicate: (Long) -> Boolean) : C { +public inline fun > LongArray.filterNotTo(result: C, predicate: (Long) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > LongArray.filterNotTo(result: C, predica * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > LongArray?.filterNotNullTo(result: C) : C { +public inline fun > LongArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > LongArray?.filterNotNullTo(result: C) : * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun LongArray.flatMapTo(result: Collection, transform: (Long) -> Collection) : Collection { +public inline fun LongArray.flatMapTo(result: MutableCollection, transform: (Long) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun LongArray.reduceRight(operation: (Long, Long) -> Long): Long = * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun LongArray.groupBy(toKey: (Long) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun LongArray.groupBy(toKey: (Long) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun LongArray.groupByTo(result: Map>, toKey: (Long) -> K) : Map> { +public inline fun LongArray.groupByTo(result: MutableMap>, toKey: (Long) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun LongArray.makeString(separator: String = ", ", prefix: String } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > LongArray.dropWhileTo(result: L, predicate: (Long) -> Boolean) : L { +public inline fun > LongArray.dropWhileTo(result: L, predicate: (Long) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > LongArray.dropWhileTo(result: L, predicate: (L } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > LongArray.takeWhileTo(result: C, predicate: (Long) -> Boolean) : C { +public inline fun > LongArray.takeWhileTo(result: C, predicate: (Long) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > LongArray.toCollection(result: C) : C { +public inline fun > LongArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/LongArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/LongArraysFromJLangIterablesJVM.kt index 621d07138ba..6b9ff88fd56 100644 --- a/libraries/stdlib/src/generated/LongArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/LongArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/LongArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/LongArraysFromJLangIterablesLazy.kt index a4f7cf15ec7..89ec02312c0 100644 --- a/libraries/stdlib/src/generated/LongArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/LongArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/LongArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/LongArraysFromJUtilCollections.kt index 741970169ef..09b08f2d843 100644 --- a/libraries/stdlib/src/generated/LongArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/LongArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > LongArray.mapTo(result: C, transform : (Long) -> R) : C { +public inline fun > LongArray.mapTo(result: C, transform : (Long) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/LongArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/LongArraysFromJUtilCollectionsJVM.kt index 45c74bde6aa..43464a2fcb3 100644 --- a/libraries/stdlib/src/generated/LongArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/LongArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun LongArray.map(transform : (Long) -> R) : java.util.List { +public inline fun LongArray.map(transform : (Long) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt index ba77814c29b..bcd3fac43bc 100644 --- a/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterables.kt +// Generated from input file: JLangIterables.kt // @@ -79,7 +79,7 @@ public inline fun ShortArray.find(predicate: (Short) -> Boolean) : Short? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > ShortArray.filterTo(result: C, predicate: (Short) -> Boolean) : C { +public inline fun > ShortArray.filterTo(result: C, predicate: (Short) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -89,7 +89,7 @@ public inline fun > ShortArray.filterTo(result: C, predicat * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > ShortArray.filterNotTo(result: C, predicate: (Short) -> Boolean) : C { +public inline fun > ShortArray.filterNotTo(result: C, predicate: (Short) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -99,7 +99,7 @@ public inline fun > ShortArray.filterNotTo(result: C, predi * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > ShortArray?.filterNotNullTo(result: C) : C { +public inline fun > ShortArray?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -111,7 +111,7 @@ public inline fun > ShortArray?.filterNotNullTo(result: C) * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun ShortArray.flatMapTo(result: Collection, transform: (Short) -> Collection) : Collection { +public inline fun ShortArray.flatMapTo(result: MutableCollection, transform: (Short) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -181,14 +181,14 @@ public inline fun ShortArray.reduceRight(operation: (Short, Short) -> Short): Sh * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun ShortArray.groupBy(toKey: (Short) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun ShortArray.groupBy(toKey: (Short) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun ShortArray.groupByTo(result: Map>, toKey: (Short) -> K) : Map> { +public inline fun ShortArray.groupByTo(result: MutableMap>, toKey: (Short) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -212,7 +212,7 @@ public inline fun ShortArray.makeString(separator: String = ", ", prefix: String } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > ShortArray.dropWhileTo(result: L, predicate: (Short) -> Boolean) : L { +public inline fun > ShortArray.dropWhileTo(result: L, predicate: (Short) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -226,13 +226,13 @@ public inline fun > ShortArray.dropWhileTo(result: L, predicate: } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > ShortArray.takeWhileTo(result: C, predicate: (Short) -> Boolean) : C { +public inline fun > ShortArray.takeWhileTo(result: C, predicate: (Short) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > ShortArray.toCollection(result: C) : C { +public inline fun > ShortArray.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesJVM.kt b/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesJVM.kt index 457a1e0767e..31ce6255791 100644 --- a/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesJVM.kt +++ b/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesJVM.kt @@ -5,7 +5,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesJVM.kt +// Generated from input file: JLangIterablesJVM.kt // diff --git a/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesLazy.kt b/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesLazy.kt index 1f8752be700..413a9cacf89 100644 --- a/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesLazy.kt +++ b/libraries/stdlib/src/generated/ShortArraysFromJLangIterablesLazy.kt @@ -5,13 +5,11 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JLangIterablesLazy.kt +// Generated from input file: JLangIterablesLazy.kt // import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/generated/ShortArraysFromJUtilCollections.kt b/libraries/stdlib/src/generated/ShortArraysFromJUtilCollections.kt index bb1230cc707..133cebaee30 100644 --- a/libraries/stdlib/src/generated/ShortArraysFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/ShortArraysFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > ShortArray.mapTo(result: C, transform : (Short) -> R) : C { +public inline fun > ShortArray.mapTo(result: C, transform : (Short) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/ShortArraysFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/ShortArraysFromJUtilCollectionsJVM.kt index 7456ab51fb2..b414b47fa94 100644 --- a/libraries/stdlib/src/generated/ShortArraysFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/ShortArraysFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun ShortArray.map(transform : (Short) -> R) : java.util.List { +public inline fun ShortArray.map(transform : (Short) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/generated/StandardFromJUtilCollections.kt b/libraries/stdlib/src/generated/StandardFromJUtilCollections.kt index f66f0524b34..1c17fda6161 100644 --- a/libraries/stdlib/src/generated/StandardFromJUtilCollections.kt +++ b/libraries/stdlib/src/generated/StandardFromJUtilCollections.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollections.kt +// Generated from input file: JUtilCollections.kt // @@ -21,7 +21,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > Iterable.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > Iterable.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/StandardFromJUtilCollectionsJVM.kt b/libraries/stdlib/src/generated/StandardFromJUtilCollectionsJVM.kt index b7f61d063c2..d6a90f7b92b 100644 --- a/libraries/stdlib/src/generated/StandardFromJUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/generated/StandardFromJUtilCollectionsJVM.kt @@ -4,7 +4,7 @@ package kotlin // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // -// Generated from input file: src/kotlin/JUtilCollectionsJVM.kt +// Generated from input file: JUtilCollectionsJVM.kt // @@ -22,6 +22,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun Iterable.map(transform : (T) -> R) : java.util.List { +public inline fun Iterable.map(transform : (T) -> R) : List { return mapTo(java.util.ArrayList(), transform) } diff --git a/libraries/stdlib/src/kotlin/ImmutableArrayList.kt b/libraries/stdlib/src/kotlin/ImmutableArrayList.kt index d0d11aa3b05..6b12e90c673 100644 --- a/libraries/stdlib/src/kotlin/ImmutableArrayList.kt +++ b/libraries/stdlib/src/kotlin/ImmutableArrayList.kt @@ -1,6 +1,5 @@ package kotlin -import java.util.List import java.util.AbstractList private class ImmutableArrayList( @@ -37,7 +36,7 @@ private class ImmutableArrayList( public override fun size() : Int = length - public override fun subList(fromIndex: Int, toIndex: Int) : List { + public override fun subList(fromIndex: Int, toIndex: Int) : MutableList { if (fromIndex < 0) { throw IndexOutOfBoundsException("Negative from index ($fromIndex)") } @@ -48,7 +47,7 @@ private class ImmutableArrayList( throw IndexOutOfBoundsException("fromIndex ($fromIndex) + toIndex ($toIndex) > length ($length)") } if (fromIndex == toIndex) { - return emptyImmutableArrayList as List + return emptyImmutableArrayList as MutableList } if (fromIndex == 0 && toIndex == length) { return this diff --git a/libraries/stdlib/src/kotlin/JLangIterables.kt b/libraries/stdlib/src/kotlin/JLangIterables.kt index aa50b0a78bc..8245bc90411 100644 --- a/libraries/stdlib/src/kotlin/JLangIterables.kt +++ b/libraries/stdlib/src/kotlin/JLangIterables.kt @@ -70,7 +70,7 @@ public inline fun Iterable.find(predicate: (T) -> Boolean) : T? { * * @includeFunctionBody ../../test/CollectionTest.kt filterIntoLinkedList */ -public inline fun > Iterable.filterTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Iterable.filterTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) return result } @@ -80,7 +80,7 @@ public inline fun > Iterable.filterTo(result: C, predi * * @includeFunctionBody ../../test/CollectionTest.kt filterNotIntoLinkedList */ -public inline fun > Iterable.filterNotTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Iterable.filterNotTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (!predicate(element)) result.add(element) return result } @@ -90,7 +90,7 @@ public inline fun > Iterable.filterNotTo(result: C, pr * * @includeFunctionBody ../../test/CollectionTest.kt filterNotNullIntoLinkedList */ -public inline fun > Iterable?.filterNotNullTo(result: C) : C { +public inline fun > Iterable?.filterNotNullTo(result: C) : C { if (this != null) { for (element in this) if (element != null) result.add(element) } @@ -102,7 +102,7 @@ public inline fun > Iterable?.filterNotNullTo(result: * * @includeFunctionBody ../../test/CollectionTest.kt flatMap */ -public inline fun Iterable.flatMapTo(result: Collection, transform: (T) -> Collection) : Collection { +public inline fun Iterable.flatMapTo(result: MutableCollection, transform: (T) -> Collection) : Collection { for (element in this) { val list = transform(element) if (list != null) { @@ -172,14 +172,14 @@ public inline fun Iterable.reduceRight(operation: (T, T) -> T): T = rever * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun Iterable.groupBy(toKey: (T) -> K) : Map> = groupByTo(HashMap>(), toKey) +public inline fun Iterable.groupBy(toKey: (T) -> K) : Map> = groupByTo(HashMap>(), toKey) /** * Groups the elements in the collection into the given [[Map]] using the supplied *toKey* function to calculate the key to group the elements by * * @includeFunctionBody ../../test/CollectionTest.kt groupBy */ -public inline fun Iterable.groupByTo(result: Map>, toKey: (T) -> K) : Map> { +public inline fun Iterable.groupByTo(result: MutableMap>, toKey: (T) -> K) : Map> { for (element in this) { val key = toKey(element) val list = result.getOrPut(key) { ArrayList() } @@ -203,7 +203,7 @@ public inline fun Iterable.makeString(separator: String = ", ", prefix: S } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ -public inline fun > Iterable.dropWhileTo(result: L, predicate: (T) -> Boolean) : L { +public inline fun > Iterable.dropWhileTo(result: L, predicate: (T) -> Boolean) : L { var start = true for (element in this) { if (start && predicate(element)) { @@ -217,13 +217,13 @@ public inline fun > Iterable.dropWhileTo(result: L, predicat } /** Returns a list containing the first elements that satisfy the given *predicate* */ -public inline fun > Iterable.takeWhileTo(result: C, predicate: (T) -> Boolean) : C { +public inline fun > Iterable.takeWhileTo(result: C, predicate: (T) -> Boolean) : C { for (element in this) if (predicate(element)) result.add(element) else break return result } /** Copies all elements into the given collection */ -public inline fun > Iterable.toCollection(result: C) : C { +public inline fun > Iterable.toCollection(result: C) : C { for (element in this) result.add(element) return result } diff --git a/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt b/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt index e178bc110ef..6a42bee05d2 100644 --- a/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt +++ b/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt @@ -1,8 +1,6 @@ package kotlin import java.util.ArrayList -import java.util.Collection -import java.util.List // // This file contains methods which could have a lazy implementation for things like diff --git a/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt b/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt index 9528356ac1a..e28533e76f9 100644 --- a/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt +++ b/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt @@ -1,8 +1,6 @@ package kotlin // Number of extension function for java.lang.Iterable that shouldn't participate in auto generation -import java.util.Collection -import java.util.List import java.util.AbstractList import java.util.Comparator import java.util.ArrayList @@ -59,7 +57,7 @@ public inline fun Iterable.first() : T { // TODO: Specify type of the exception public fun Iterable.last() : T { if (this is List) { - return this.get(this.size() - 1); + return this.get(this.size() - 1) } val iterator = this.iterator().sure() @@ -98,7 +96,7 @@ public fun Iterable.contains(item : T) : Boolean { * * @includeFunctionBody ../../test/ListTest.kt withIndices */ -public fun Iterable.withIndices(): java.util.List<#(Int, T)> { +public fun Iterable.withIndices(): List<#(Int, T)> { val answer = ArrayList<#(Int, T)>() var nextIndex = 0 for (e in this) { diff --git a/libraries/stdlib/src/kotlin/JLangIterablesSpecialJVM.kt b/libraries/stdlib/src/kotlin/JLangIterablesSpecialJVM.kt index 12a99979287..c12a48d5185 100644 --- a/libraries/stdlib/src/kotlin/JLangIterablesSpecialJVM.kt +++ b/libraries/stdlib/src/kotlin/JLangIterablesSpecialJVM.kt @@ -1,10 +1,7 @@ package kotlin import java.util.AbstractList -import java.util.Collection import java.util.Comparator -import java.util.Iterator -import java.util.List // TODO this function is here as it breaks the JS compiler; lets move back to JLangIterablesSpecial when it works again :) @@ -15,7 +12,7 @@ import java.util.List * * @includeFunctionBody ../../test/CollectionTest.kt sortBy */ -public inline fun > Iterable.sortBy(f: (T) -> R): java.util.List { +public inline fun > Iterable.sortBy(f: (T) -> R): List { val sortedList = this.toList() val sortBy: Comparator = comparator {(x: T, y: T) -> val xr = f(x) diff --git a/libraries/stdlib/src/kotlin/JUtil.kt b/libraries/stdlib/src/kotlin/JUtil.kt index 239b4ed05fe..5b0648874e3 100644 --- a/libraries/stdlib/src/kotlin/JUtil.kt +++ b/libraries/stdlib/src/kotlin/JUtil.kt @@ -19,7 +19,7 @@ val Int.indices: IntRange /** * Converts the collection to an array */ -public inline fun java.util.Collection.toArray() : Array { +public inline fun Collection.toArray() : Array { val answer = arrayOfNulls(this.size) var idx = 0 for (elem in this) @@ -28,10 +28,10 @@ public inline fun java.util.Collection.toArray() : Array { } /** Returns true if the collection is not empty */ -public inline fun java.util.Collection.notEmpty() : Boolean = !this.isEmpty() +public inline fun Collection.notEmpty() : Boolean = !this.isEmpty() /** Returns the Collection if its not null otherwise it returns the empty list */ -public inline fun java.util.Collection?.orEmpty() : Collection +public inline fun Collection?.orEmpty() : Collection = if (this != null) this else Collections.emptyList() as Collection @@ -44,8 +44,8 @@ public inline fun > Iterable.toSortedList(comparator: jav // List APIs /** Returns the List if its not null otherwise returns the empty list */ -public inline fun java.util.List?.orEmpty() : java.util.List - = if (this != null) this else Collections.emptyList() as java.util.List +public inline fun List?.orEmpty() : List + = if (this != null) this else Collections.emptyList() as List /** TODO figure out necessary variance/generics ninja stuff... :) diff --git a/libraries/stdlib/src/kotlin/JUtilCollections.kt b/libraries/stdlib/src/kotlin/JUtilCollections.kt index 9d6b3abb55a..655a6158090 100644 --- a/libraries/stdlib/src/kotlin/JUtilCollections.kt +++ b/libraries/stdlib/src/kotlin/JUtilCollections.kt @@ -13,7 +13,7 @@ import java.util.* * Transforms each element of this collection with the given *transform* function and * adds each return value to the given *results* collection */ -public inline fun > java.util.Collection.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > Collection.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/kotlin/JUtilCollectionsJVM.kt b/libraries/stdlib/src/kotlin/JUtilCollectionsJVM.kt index b080136e8a4..870243bfd81 100644 --- a/libraries/stdlib/src/kotlin/JUtilCollectionsJVM.kt +++ b/libraries/stdlib/src/kotlin/JUtilCollectionsJVM.kt @@ -14,6 +14,6 @@ import java.util.* * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun java.util.Collection.map(transform : (T) -> R) : java.util.List { +public inline fun Collection.map(transform : (T) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } diff --git a/libraries/stdlib/src/kotlin/JUtilJVM.kt b/libraries/stdlib/src/kotlin/JUtilJVM.kt index 03bf201ab86..be1565bca42 100644 --- a/libraries/stdlib/src/kotlin/JUtilJVM.kt +++ b/libraries/stdlib/src/kotlin/JUtilJVM.kt @@ -75,8 +75,8 @@ public inline fun linkedMap(vararg values: #(K,V)): LinkedHashMap { /** Returns the Set if its not null otherwise returns the empty set */ -public inline fun java.util.Set?.orEmpty() : java.util.Set - = if (this != null) this else Collections.EMPTY_SET as java.util.Set +public inline fun Set?.orEmpty() : Set + = if (this != null) this else Collections.EMPTY_SET as Set /** Returns a new ArrayList with a variable number of initial elements */ public inline fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size)) diff --git a/libraries/stdlib/src/kotlin/JUtilMaps.kt b/libraries/stdlib/src/kotlin/JUtilMaps.kt index ef0ffa60665..0621c1b6da3 100644 --- a/libraries/stdlib/src/kotlin/JUtilMaps.kt +++ b/libraries/stdlib/src/kotlin/JUtilMaps.kt @@ -1,28 +1,24 @@ package kotlin -import java.util.Collection import java.util.Collections import java.util.HashMap -import java.util.List -import java.util.Map as JMap -import java.util.Map // Map APIs /** Returns the size of the map */ -val JMap<*,*>.size : Int +val Map<*,*>.size : Int get() = size() /** Returns true if this map is empty */ -val JMap<*,*>.empty : Boolean +val Map<*,*>.empty : Boolean get() = isEmpty() /** Provides [] access to maps */ -public fun JMap.set(key : K, value : V) : V? = this.put(key, value) +public fun MutableMap.set(key : K, value : V) : V? = this.put(key, value) /** Returns the [[Map]] if its not null otherwise it returns the empty [[Map]] */ -public inline fun java.util.Map?.orEmpty() : java.util.Map -= if (this != null) this else Collections.emptyMap() as java.util.Map +public inline fun Map?.orEmpty() : Map += if (this != null) this else Collections.emptyMap() as Map /** Returns the key of the entry */ @@ -38,7 +34,7 @@ val Map.Entry.value : V * * @includeFunctionBody ../../test/MapTest.kt getOrElse */ -public inline fun java.util.Map.getOrElse(key: K, defaultValue: ()-> V) : V { +public inline fun Map.getOrElse(key: K, defaultValue: ()-> V) : V { val current = this.get(key) if (current != null) { return current @@ -52,7 +48,7 @@ public inline fun java.util.Map.getOrElse(key: K, defaultValue: ()-> * * @includeFunctionBody ../../test/MapTest.kt getOrElse */ -public inline fun java.util.Map.getOrPut(key: K, defaultValue: ()-> V) : V { +public inline fun MutableMap.getOrPut(key: K, defaultValue: ()-> V) : V { val current = this.get(key) if (current != null) { return current @@ -69,7 +65,7 @@ public inline fun java.util.Map.getOrPut(key: K, defaultValue: ()-> V * * @includeFunctionBody ../../test/MapTest.kt iterateWithProperties */ -public inline fun java.util.Map.iterator(): Iterator> { +public inline fun Map.iterator(): Iterator> { val entrySet = this.entrySet()!! return entrySet.iterator()!! } @@ -78,7 +74,7 @@ public inline fun java.util.Map.iterator(): Iterator> java.util.Map.mapTo(result: C, transform: (java.util.Map.Entry) -> R) : C { +public inline fun > Map.mapTo(result: C, transform: (Map.Entry) -> R) : C { for (item in this) result.add(transform(item)) return result @@ -87,7 +83,7 @@ public inline fun > java.util.Map.mapTo(result: /** * Populates the given *result* [[Map]] with the value returned by applying the *transform* function on each [[Map.Entry]] in this [[Map]] */ -public inline fun > java.util.Map.mapValuesTo(result: C, transform : (java.util.Map.Entry) -> R) : C { +public inline fun > MutableMap.mapValuesTo(result: C, transform : (Map.Entry) -> R) : C { for (e in this) { val newValue = transform(e) result.put(e.key, newValue) @@ -98,7 +94,7 @@ public inline fun > java.util.Map.mapValuesTo(r /** * Puts all the entries into the map with the first value in the tuple being the key and the second the value */ -public inline fun java.util.Map.putAll(vararg values: #(K,V)): Unit { +public inline fun MutableMap.putAll(vararg values: #(K,V)): Unit { for (v in values) { put(v._1, v._2) } @@ -107,7 +103,7 @@ public inline fun java.util.Map.putAll(vararg values: #(K,V)): Unit { /** * Copies the entries in this [[Map]] to the given *map* */ -public inline fun java.util.Map.toMap(map: Map): Map { +public inline fun Map.toMap(map: MutableMap): Map { map.putAll(this) return map } diff --git a/libraries/stdlib/src/kotlin/JUtilMapsJVM.kt b/libraries/stdlib/src/kotlin/JUtilMapsJVM.kt index 56ac29988ed..be615a9c814 100644 --- a/libraries/stdlib/src/kotlin/JUtilMapsJVM.kt +++ b/libraries/stdlib/src/kotlin/JUtilMapsJVM.kt @@ -2,9 +2,6 @@ package kotlin import java.util.Comparator import java.util.LinkedHashMap -import java.util.Map as JMap -import java.util.Map -import java.util.Map.Entry as JEntry import java.util.SortedMap import java.util.TreeMap import java.util.Properties @@ -14,14 +11,14 @@ import java.util.Properties /** * Converts this [[Map]] to a [[LinkedHashMap]] so future insertion orders are maintained */ -public inline fun java.util.Map.toLinkedMap(): LinkedHashMap = toMap(LinkedHashMap(size)) as LinkedHashMap +public inline fun Map.toLinkedMap(): LinkedHashMap = toMap(LinkedHashMap(size)) as LinkedHashMap /** * Converts this [[Map]] to a [[SortedMap]] so iteration order will be in key order * * @includeFunctionBody ../../test/MapTest.kt toSortedMap */ -public inline fun java.util.Map.toSortedMap(): SortedMap = toMap(TreeMap()) as SortedMap +public inline fun Map.toSortedMap(): SortedMap = toMap(TreeMap()) as SortedMap /** * Converts this [[Map]] to a [[SortedMap]] using the given *comparator* so that iteration order will be in the order @@ -29,7 +26,7 @@ public inline fun java.util.Map.toSortedMap(): SortedMap = toMap * * @includeFunctionBody ../../test/MapTest.kt toSortedMapWithComparator */ -public inline fun java.util.Map.toSortedMap(comparator: Comparator): SortedMap = toMap(TreeMap(comparator)) as SortedMap +public inline fun Map.toSortedMap(comparator: Comparator): SortedMap = toMap(TreeMap(comparator)) as SortedMap /** @@ -50,7 +47,7 @@ public inline fun Map.toProperties(): Properties { * * @includeFunctionBody ../../test/CollectionTest.kt map */ -public inline fun java.util.Map.map(transform: (java.util.Map.Entry) -> R) : java.util.List { +public inline fun Map.map(transform: (Map.Entry) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) } @@ -60,7 +57,7 @@ public inline fun java.util.Map.map(transform: (java.util.Map.Entry * * @includeFunctionBody ../../test/MapTest.kt mapValues */ -public inline fun java.util.Map.mapValues(transform : (java.util.Map.Entry) -> R): java.util.Map { +public inline fun MutableMap.mapValues(transform : (Map.Entry) -> R): Map { return mapValuesTo(java.util.HashMap(this.size), transform) } diff --git a/libraries/stdlib/src/kotlin/Standard.kt b/libraries/stdlib/src/kotlin/Standard.kt index a144f2d5ee8..fbbe3a706dc 100644 --- a/libraries/stdlib/src/kotlin/Standard.kt +++ b/libraries/stdlib/src/kotlin/Standard.kt @@ -1,7 +1,6 @@ package kotlin import java.util.ArrayList -import java.util.Collection import java.util.HashSet import java.util.LinkedList diff --git a/libraries/stdlib/src/kotlin/StandardJVM.kt b/libraries/stdlib/src/kotlin/StandardJVM.kt index 853481bbcc6..97691e789dd 100644 --- a/libraries/stdlib/src/kotlin/StandardJVM.kt +++ b/libraries/stdlib/src/kotlin/StandardJVM.kt @@ -1,6 +1,5 @@ package kotlin -import java.util.Collection import java.util.ArrayList import java.util.LinkedList import java.util.HashSet diff --git a/libraries/stdlib/src/kotlin/Strings.kt b/libraries/stdlib/src/kotlin/Strings.kt index 47a14c43447..bf8625f272f 100644 --- a/libraries/stdlib/src/kotlin/Strings.kt +++ b/libraries/stdlib/src/kotlin/Strings.kt @@ -1,6 +1,5 @@ package kotlin -import java.util.List import java.util.ArrayList /** Returns the string with leading and trailing text matching the given string removed */ diff --git a/libraries/stdlib/src/kotlin/StringsJVM.kt b/libraries/stdlib/src/kotlin/StringsJVM.kt index eaa74059bc5..ae0a0183451 100644 --- a/libraries/stdlib/src/kotlin/StringsJVM.kt +++ b/libraries/stdlib/src/kotlin/StringsJVM.kt @@ -1,7 +1,6 @@ package kotlin import java.io.StringReader -import java.util.List public inline fun String.lastIndexOf(str: String) : Int = (this as java.lang.String).lastIndexOf(str) diff --git a/libraries/stdlib/src/kotlin/dom/DomJVM.kt b/libraries/stdlib/src/kotlin/dom/DomJVM.kt index d84342d873b..17d64a9b217 100644 --- a/libraries/stdlib/src/kotlin/dom/DomJVM.kt +++ b/libraries/stdlib/src/kotlin/dom/DomJVM.kt @@ -118,7 +118,7 @@ fun Node.nextElements(): Iterator = nextSiblings().filterIsInstance = previousSiblings().filterIsInstance(javaClass()) -var Element.classSet : Set +var Element.classSet : MutableSet get() { val answer = LinkedHashSet() val array = this.classes.split("""\s""") diff --git a/libraries/stdlib/src/kotlin/io/Files.kt b/libraries/stdlib/src/kotlin/io/Files.kt index fc996398bd0..ad7437c4f15 100644 --- a/libraries/stdlib/src/kotlin/io/Files.kt +++ b/libraries/stdlib/src/kotlin/io/Files.kt @@ -3,7 +3,6 @@ package kotlin.io import java.io.* import java.nio.charset.* import java.util.NoSuchElementException -import java.util.List import java.util.ArrayList import java.net.URL diff --git a/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt b/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt index ccf0f576c52..3adc8dc405f 100644 --- a/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt +++ b/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt @@ -54,9 +54,9 @@ open class ModuleBuilder(val name: String): Module { annotationsRoots0.add(name) } - public override fun getSourceFiles(): List? = sourceFiles0 - public override fun getClasspathRoots(): List? = classpathRoots0 - public override fun getAnnotationsRoots(): List? = annotationsRoots0 + public override fun getSourceFiles(): MutableList? = sourceFiles0 + public override fun getClasspathRoots(): MutableList? = classpathRoots0 + public override fun getAnnotationsRoots(): MutableList? = annotationsRoots0 public override fun getModuleName(): String? = name } diff --git a/libraries/stdlib/src/kotlin/nullable/Nullables.kt b/libraries/stdlib/src/kotlin/nullable/Nullables.kt index 13d3a9af5a1..9da856d4878 100644 --- a/libraries/stdlib/src/kotlin/nullable/Nullables.kt +++ b/libraries/stdlib/src/kotlin/nullable/Nullables.kt @@ -26,7 +26,7 @@ public inline fun T?.find(predicate: (T)-> Boolean): T? { public inline fun T?.filter(predicate: (T)-> Boolean): T? = find(predicate) /** Filters all elements in this collection which match the given predicate into the given result collection */ -public inline fun > T?.filterTo(result: C, predicate: (T)-> Boolean): C { +public inline fun > T?.filterTo(result: C, predicate: (T)-> Boolean): C { if (this != null && predicate(this)) result.add(this) return result @@ -36,7 +36,7 @@ public inline fun > T?.filterTo(result: C, predicate: (T) public inline fun T?.filterNotNull(): Collection = filterNotNullTo(java.util.ArrayList()) /** Filters all the null elements in this collection winto the given result collection */ -public inline fun > T?.filterNotNullTo(result: C): C { +public inline fun > T?.filterNotNullTo(result: C): C { if (this != null) { result.add(this) } @@ -47,7 +47,7 @@ public inline fun > T?.filterNotNullTo(result: C): C { public inline fun T?.filterNot(predicate: (T)-> Boolean): Collection = filterNotTo(ArrayList(), predicate) /** Returns a new collection containing all elements in this collection which do not match the given predicate */ -public inline fun > T?.filterNotTo(result: C, predicate: (T)-> Boolean): C { +public inline fun > T?.filterNotTo(result: C, predicate: (T)-> Boolean): C { if (this != null && !predicate(this)) { result.add(this) } @@ -58,7 +58,7 @@ public inline fun > T?.filterNotTo(result: C, predicate: * Returns the result of transforming each item in the collection to a one or more values which * are concatenated together into a single collection */ -public inline fun T?.flatMap(transform: (T)-> Collection): Collection { +public inline fun T?.flatMap(transform: (T)-> MutableCollection): Collection { return flatMapTo(ArrayList(), transform) } @@ -66,7 +66,7 @@ public inline fun T?.flatMap(transform: (T)-> Collection): Collection< * Returns the result of transforming each item in the collection to a one or more values which * are concatenated together into a single collection */ -public inline fun T?.flatMapTo(result: Collection, transform: (T)-> Collection): Collection { +public inline fun T?.flatMapTo(result: MutableCollection, transform: (T)-> MutableCollection): Collection { if (this != null) { val coll = transform(this) if (coll != null) { @@ -111,7 +111,7 @@ public inline fun T?.foldRight(initial: T, operation: (it: T, it2: T) -> T): * Iterates through the collection performing the transformation on each element and using the result * as the key in a map to group elements by the result */ -public inline fun T?.groupBy(result: Map> = HashMap>(), toKey: (T)-> K): Map> { +public inline fun T?.groupBy(result: MutableMap> = HashMap>(), toKey: (T)-> K): Map> { if (this != null) { val key = toKey(this) val list = result.getOrPut(key){ ArrayList() } @@ -143,7 +143,7 @@ public inline fun T?.map(transform : (T) -> R) : R? { } /** Transforms each element of this collection with the given function then adds the results to the given collection */ -public inline fun > T?.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > T?.mapTo(result: C, transform : (T) -> R) : C { if (this != null) { result.add(transform(this)) } @@ -156,7 +156,7 @@ public inline fun T?.reverse(): T? { } /** Copies the collection into the given collection */ -public inline fun > T?.toCollection(result: C): C { +public inline fun > T?.toCollection(result: C): C { if (this != null) result.add(this) return result diff --git a/libraries/stdlib/src/kotlin/properties/Properties.kt b/libraries/stdlib/src/kotlin/properties/Properties.kt index 7138e0ed14b..06beec8ec1b 100644 --- a/libraries/stdlib/src/kotlin/properties/Properties.kt +++ b/libraries/stdlib/src/kotlin/properties/Properties.kt @@ -2,8 +2,6 @@ package kotlin.properties import kotlin.* import kotlin.util.* -import java.util.List -import java.util.Map import java.util.HashMap import java.util.ArrayList @@ -23,8 +21,8 @@ public trait ChangeListener { * change tracking mechanisms for persistence or distributed change notifications. */ public abstract class ChangeSupport { - private var allListeners: List? = null - private var nameListeners: Map>? = null + private var allListeners: MutableList? = null + private var nameListeners: MutableMap>? = null public fun addChangeListener(listener: ChangeListener) { @@ -36,7 +34,7 @@ public abstract class ChangeSupport { public fun addChangeListener(name: String, listener: ChangeListener) { if (nameListeners == null) { - nameListeners = HashMap>() + nameListeners = HashMap>() } var listeners = nameListeners?.get(name) if (listeners == null) { diff --git a/libraries/stdlib/test/ImmutableArrayListTest.kt b/libraries/stdlib/test/ImmutableArrayListTest.kt index a6b09c439e7..0ff92c2bb63 100644 --- a/libraries/stdlib/test/ImmutableArrayListTest.kt +++ b/libraries/stdlib/test/ImmutableArrayListTest.kt @@ -3,7 +3,6 @@ package test.collection import kotlin.test.* import junit.framework.TestCase -import java.util.List import java.util.Random class ImmutableArrayListTest() : TestCase() { diff --git a/libraries/stdlib/test/StdLibIssuesTest.kt b/libraries/stdlib/test/StdLibIssuesTest.kt index 485f1f3e0c2..494edc7574e 100644 --- a/libraries/stdlib/test/StdLibIssuesTest.kt +++ b/libraries/stdlib/test/StdLibIssuesTest.kt @@ -1,6 +1,5 @@ package test.stdlib.issues -import java.util.List import kotlin.util.* import kotlin.test.* import junit.framework.TestCase diff --git a/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateJavaScriptStubs.kt b/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateJavaScriptStubs.kt index 8c2ca3b4561..1ca0d7e5b37 100644 --- a/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateJavaScriptStubs.kt +++ b/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateJavaScriptStubs.kt @@ -9,7 +9,6 @@ import java.util.ArrayList import java.util.TreeMap import org.w3c.dom.* import org.w3c.dom.events.* -import java.util.List /** * This tool generates JavaScript stubs for classes available in the JDK which are already available in the browser environment diff --git a/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateStandardLib.kt b/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateStandardLib.kt index 070030a1d95..6d947bef92a 100644 --- a/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateStandardLib.kt +++ b/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateStandardLib.kt @@ -1,7 +1,6 @@ package org.jetbrains.kotlin.tools import java.io.* -import java.util.List private val COMMON_AUTOGENERATED_WARNING: String = """// // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt @@ -116,27 +115,27 @@ fun main(args: Array) { // JUtilCollections - methods returning a collection of the same input size (if its a collection) generateFile(File(outDir, "ArraysFromJUtilCollections.kt"), "package kotlin", File(srcDir, "JUtilCollections.kt")) { - it.replaceAll("java.util.Collection java.util.Collection", "${arrayName}Array"). - replaceAll("java.util.Collection", "${arrayName}Array")) + replaceGenerics(arrayName, it.replaceAll(" Collection", "${arrayName}Array"). + replaceAll("Collection", "${arrayName}Array")) } generateFile(File(outDir, "${arrayName}ArraysFromJUtilCollectionsJVM.kt"), "package kotlin", File(srcDir, "JUtilCollectionsJVM.kt")) { - replaceGenerics(arrayName, it.replaceAll(" java.util.Collection", "${arrayName}Array"). - replaceAll("java.util.Collection", "${arrayName}Array")) + replaceGenerics(arrayName, it.replaceAll(" Collection", "${arrayName}Array"). + replaceAll("Collection", "${arrayName}Array")) } } generateFile(File(outDir, "StandardFromJUtilCollections.kt"), "package kotlin", File(srcDir, "JUtilCollections.kt")) { - it.replaceAll("java.util.Collection