From ce23fe79415f513e2ce571b0c01d279726e71afb Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 4 Sep 2012 19:07:41 +0400 Subject: [PATCH] added toMutableList, toMutableCollection, toMutableSet methods to standard library --- .../stdlib/src/generated/ArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/BooleanArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/ByteArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/CharArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/DoubleArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/FloatArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/IntArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/JUtilIteratorsFromJLangIterables.kt | 11 ++++++++++- .../src/generated/LongArraysFromJLangIterables.kt | 11 ++++++++++- .../src/generated/ShortArraysFromJLangIterables.kt | 11 ++++++++++- libraries/stdlib/src/kotlin/JLangIterables.kt | 11 ++++++++++- 11 files changed, 110 insertions(+), 11 deletions(-) diff --git a/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt index 2c838038917..208cc5466e6 100644 --- a/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/ArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > Array.toCollection(resul * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun Array.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun Array.toCollection() : Collection = toCollection( /** Copies all elements into a [[Set]] */ public inline fun Array.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun Array.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun Array.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun Array.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun Array.toSortedList(transform: fun(T) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt index d47ec3525bb..61480034bcb 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > BooleanArray.toCollection(resu * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun BooleanArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun BooleanArray.toCollection() : Collection = toCollect /** Copies all elements into a [[Set]] */ public inline fun BooleanArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun BooleanArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun BooleanArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun BooleanArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun BooleanArray.toSortedList(transform: fun(Boolean) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt index 3eae7ff6e67..174c0c2e2e2 100644 --- a/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/ByteArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > ByteArray.toCollection(result: C) * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun ByteArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun ByteArray.toCollection() : Collection = toCollection(Ar /** Copies all elements into a [[Set]] */ public inline fun ByteArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun ByteArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun ByteArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun ByteArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun ByteArray.toSortedList(transform: fun(Byte) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt index bd6234105e9..a4468972ec1 100644 --- a/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/CharArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > CharArray.toCollection(result: C) * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun CharArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun CharArray.toCollection() : Collection = toCollection(Ar /** Copies all elements into a [[Set]] */ public inline fun CharArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun CharArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun CharArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun CharArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun CharArray.toSortedList(transform: fun(Char) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt index 89e49a0816e..9295d5d9179 100644 --- a/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/DoubleArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > DoubleArray.toCollection(result * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun DoubleArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun DoubleArray.toCollection() : Collection = toCollectio /** Copies all elements into a [[Set]] */ public inline fun DoubleArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun DoubleArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun DoubleArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun DoubleArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun DoubleArray.toSortedList(transform: fun(Double) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt index 562f0883c72..59b74d2f33d 100644 --- a/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/FloatArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > FloatArray.toCollection(result: * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun FloatArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun FloatArray.toCollection() : Collection = toCollection( /** Copies all elements into a [[Set]] */ public inline fun FloatArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun FloatArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun FloatArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun FloatArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun FloatArray.toSortedList(transform: fun(Float) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt index 6a3e875b6c6..4b6315625ac 100644 --- a/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/IntArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > IntArray.toCollection(result: C) : * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun IntArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun IntArray.toCollection() : Collection = toCollection(Arra /** Copies all elements into a [[Set]] */ public inline fun IntArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun IntArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun IntArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun IntArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun IntArray.toSortedList(transform: fun(Int) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt b/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt index 87d8d482ea2..2c969bb9557 100644 --- a/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/JUtilIteratorsFromJLangIterables.kt @@ -242,7 +242,7 @@ public inline fun > Iterator.toCollection(re * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun Iterator.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -259,6 +259,15 @@ public inline fun Iterator.toCollection() : Collection = toCollecti /** Copies all elements into a [[Set]] */ public inline fun Iterator.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun Iterator.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun Iterator.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun Iterator.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun Iterator.toSortedList(transform: fun(T) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt index c33df9dc3ea..b12972d933f 100644 --- a/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/LongArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > LongArray.toCollection(result: C) * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun LongArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun LongArray.toCollection() : Collection = toCollection(Ar /** Copies all elements into a [[Set]] */ public inline fun LongArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun LongArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun LongArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun LongArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun LongArray.toSortedList(transform: fun(Long) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt b/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt index bcd3fac43bc..03a528165d3 100644 --- a/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt +++ b/libraries/stdlib/src/generated/ShortArraysFromJLangIterables.kt @@ -243,7 +243,7 @@ public inline fun > ShortArray.toCollection(result: * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun ShortArray.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -260,6 +260,15 @@ public inline fun ShortArray.toCollection() : Collection = toCollection( /** Copies all elements into a [[Set]] */ public inline fun ShortArray.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun ShortArray.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun ShortArray.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun ShortArray.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun ShortArray.toSortedList(transform: fun(Short) : java.lang.Comparable<*>) : List { diff --git a/libraries/stdlib/src/kotlin/JLangIterables.kt b/libraries/stdlib/src/kotlin/JLangIterables.kt index 8245bc90411..d208f95f766 100644 --- a/libraries/stdlib/src/kotlin/JLangIterables.kt +++ b/libraries/stdlib/src/kotlin/JLangIterables.kt @@ -234,7 +234,7 @@ public inline fun > Iterable.toCollection(re * @includeFunctionBody ../../test/CollectionTest.kt reverse */ public inline fun Iterable.reverse() : List { - val list = toList() + val list = toMutableList() Collections.reverse(list) return list } @@ -251,6 +251,15 @@ public inline fun Iterable.toCollection() : Collection = toCollecti /** Copies all elements into a [[Set]] */ public inline fun Iterable.toSet() : Set = toCollection(HashSet()) +/** Copies all elements into a [[MutableList]] */ +public inline fun Iterable.toMutableList() : MutableList = toCollection(ArrayList()) + +/** Copies all elements into a [[List] */ +public inline fun Iterable.toMutableCollection() : MutableCollection = toCollection(ArrayList()) + +/** Copies all elements into a [[Set]] */ +public inline fun Iterable.toMutableSet() : MutableSet = toCollection(HashSet()) + /** TODO figure out necessary variance/generics ninja stuff... :) public inline fun Iterable.toSortedList(transform: fun(T) : java.lang.Comparable<*>) : List {