Variance in functions/properties removed from stdlib

This commit is contained in:
Andrey Breslav
2012-11-22 13:58:27 +04:00
parent 12fd07af08
commit 5b93ae2d08
40 changed files with 103 additions and 103 deletions
@@ -248,7 +248,7 @@ public inline fun <T, C: MutableCollection<in T>> Array<T>.takeWhileTo(result: C
}
/** Copies all elements into the given collection */
public inline fun <in T, C: MutableCollection<in T>> Array<T>.toCollection(result: C) : C {
public inline fun <T, C: MutableCollection<in T>> Array<T>.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -265,16 +265,16 @@ public inline fun <T> Array<T>.reverse() : List<T> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun <in T> Array<T>.toLinkedList() : LinkedList<T> = toCollection(LinkedList<T>())
public inline fun <T> Array<T>.toLinkedList() : LinkedList<T> = toCollection(LinkedList<T>())
/** Copies all elements into a [[List]] */
public inline fun <in T> Array<T>.toList() : List<T> = toCollection(ArrayList<T>())
public inline fun <T> Array<T>.toList() : List<T> = toCollection(ArrayList<T>())
/** Copies all elements into a [[List] */
public inline fun <in T> Array<T>.toCollection() : Collection<T> = toCollection(ArrayList<T>())
public inline fun <T> Array<T>.toCollection() : Collection<T> = toCollection(ArrayList<T>())
/** Copies all elements into a [[Set]] */
public inline fun <in T> Array<T>.toSet() : Set<T> = toCollection(HashSet<T>())
public inline fun <T> Array<T>.toSet() : Set<T> = toCollection(HashSet<T>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun <in T> Array<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
public inline fun <T> Array<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
@@ -51,7 +51,7 @@ public inline fun <T, R> Array<T>.flatMap(transform: (T)-> Collection<R>) : Coll
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun <in T> Array<T>.plus(element: T): List<in T> {
public inline fun <T> Array<T>.plus(element: T): List<T> {
val list = toCollection(ArrayList<T>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun <in T> Array<T>.plus(element: T): List<in T> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun <in T> Array<T>.plus(elements: Array<T>): List<T> {
public inline fun <T> Array<T>.plus(elements: Array<T>): List<T> {
val list = toCollection(ArrayList<T>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun <in T> Array<T>.plus(elements: Array<T>): List<T> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun <in T> Array<T?>.requireNoNulls() : List<T> {
public inline fun <T> Array<T?>.requireNoNulls() : List<T> {
val list = ArrayList<T>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun BooleanArray.reverse() : List<Boolean> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun BooleanArray.toLinkedList() : LinkedList<Boolean> = toCollection(LinkedList<Boolean>())
public inline fun BooleanArray.toLinkedList() : LinkedList<Boolean> = toCollection(LinkedList<Boolean>())
/** Copies all elements into a [[List]] */
public inline fun BooleanArray.toList() : List<Boolean> = toCollection(ArrayList<Boolean>())
public inline fun BooleanArray.toList() : List<Boolean> = toCollection(ArrayList<Boolean>())
/** Copies all elements into a [[List] */
public inline fun BooleanArray.toCollection() : Collection<Boolean> = toCollection(ArrayList<Boolean>())
public inline fun BooleanArray.toCollection() : Collection<Boolean> = toCollection(ArrayList<Boolean>())
/** Copies all elements into a [[Set]] */
public inline fun BooleanArray.toSet() : Set<Boolean> = toCollection(HashSet<Boolean>())
public inline fun BooleanArray.toSet() : Set<Boolean> = toCollection(HashSet<Boolean>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun BooleanArray.toSortedSet() : SortedSet<Boolean> = toCollection(TreeSet<Boolean>())
public inline fun BooleanArray.toSortedSet() : SortedSet<Boolean> = toCollection(TreeSet<Boolean>())
@@ -51,7 +51,7 @@ public inline fun <R> BooleanArray.flatMap(transform: (Boolean)-> Collection<R>)
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun BooleanArray.plus(element: Boolean): List<Boolean> {
public inline fun BooleanArray.plus(element: Boolean): List<Boolean> {
val list = toCollection(ArrayList<Boolean>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun BooleanArray.plus(element: Boolean): List<Boolean> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun BooleanArray.plus(elements: BooleanArray): List<Boolean> {
public inline fun BooleanArray.plus(elements: BooleanArray): List<Boolean> {
val list = toCollection(ArrayList<Boolean>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun BooleanArray.plus(elements: BooleanArray): List<Boolean> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun BooleanArray.requireNoNulls() : List<Boolean> {
public inline fun BooleanArray.requireNoNulls() : List<Boolean> {
val list = ArrayList<Boolean>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun ByteArray.reverse() : List<Byte> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun ByteArray.toLinkedList() : LinkedList<Byte> = toCollection(LinkedList<Byte>())
public inline fun ByteArray.toLinkedList() : LinkedList<Byte> = toCollection(LinkedList<Byte>())
/** Copies all elements into a [[List]] */
public inline fun ByteArray.toList() : List<Byte> = toCollection(ArrayList<Byte>())
public inline fun ByteArray.toList() : List<Byte> = toCollection(ArrayList<Byte>())
/** Copies all elements into a [[List] */
public inline fun ByteArray.toCollection() : Collection<Byte> = toCollection(ArrayList<Byte>())
public inline fun ByteArray.toCollection() : Collection<Byte> = toCollection(ArrayList<Byte>())
/** Copies all elements into a [[Set]] */
public inline fun ByteArray.toSet() : Set<Byte> = toCollection(HashSet<Byte>())
public inline fun ByteArray.toSet() : Set<Byte> = toCollection(HashSet<Byte>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun ByteArray.toSortedSet() : SortedSet<Byte> = toCollection(TreeSet<Byte>())
public inline fun ByteArray.toSortedSet() : SortedSet<Byte> = toCollection(TreeSet<Byte>())
@@ -51,7 +51,7 @@ public inline fun <R> ByteArray.flatMap(transform: (Byte)-> Collection<R>) : Col
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun ByteArray.plus(element: Byte): List<Byte> {
public inline fun ByteArray.plus(element: Byte): List<Byte> {
val list = toCollection(ArrayList<Byte>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun ByteArray.plus(element: Byte): List<Byte> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun ByteArray.plus(elements: ByteArray): List<Byte> {
public inline fun ByteArray.plus(elements: ByteArray): List<Byte> {
val list = toCollection(ArrayList<Byte>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun ByteArray.plus(elements: ByteArray): List<Byte> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun ByteArray.requireNoNulls() : List<Byte> {
public inline fun ByteArray.requireNoNulls() : List<Byte> {
val list = ArrayList<Byte>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun CharArray.reverse() : List<Char> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun CharArray.toLinkedList() : LinkedList<Char> = toCollection(LinkedList<Char>())
public inline fun CharArray.toLinkedList() : LinkedList<Char> = toCollection(LinkedList<Char>())
/** Copies all elements into a [[List]] */
public inline fun CharArray.toList() : List<Char> = toCollection(ArrayList<Char>())
public inline fun CharArray.toList() : List<Char> = toCollection(ArrayList<Char>())
/** Copies all elements into a [[List] */
public inline fun CharArray.toCollection() : Collection<Char> = toCollection(ArrayList<Char>())
public inline fun CharArray.toCollection() : Collection<Char> = toCollection(ArrayList<Char>())
/** Copies all elements into a [[Set]] */
public inline fun CharArray.toSet() : Set<Char> = toCollection(HashSet<Char>())
public inline fun CharArray.toSet() : Set<Char> = toCollection(HashSet<Char>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun CharArray.toSortedSet() : SortedSet<Char> = toCollection(TreeSet<Char>())
public inline fun CharArray.toSortedSet() : SortedSet<Char> = toCollection(TreeSet<Char>())
@@ -51,7 +51,7 @@ public inline fun <R> CharArray.flatMap(transform: (Char)-> Collection<R>) : Col
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun CharArray.plus(element: Char): List<Char> {
public inline fun CharArray.plus(element: Char): List<Char> {
val list = toCollection(ArrayList<Char>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun CharArray.plus(element: Char): List<Char> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun CharArray.plus(elements: CharArray): List<Char> {
public inline fun CharArray.plus(elements: CharArray): List<Char> {
val list = toCollection(ArrayList<Char>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun CharArray.plus(elements: CharArray): List<Char> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun CharArray.requireNoNulls() : List<Char> {
public inline fun CharArray.requireNoNulls() : List<Char> {
val list = ArrayList<Char>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun DoubleArray.reverse() : List<Double> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun DoubleArray.toLinkedList() : LinkedList<Double> = toCollection(LinkedList<Double>())
public inline fun DoubleArray.toLinkedList() : LinkedList<Double> = toCollection(LinkedList<Double>())
/** Copies all elements into a [[List]] */
public inline fun DoubleArray.toList() : List<Double> = toCollection(ArrayList<Double>())
public inline fun DoubleArray.toList() : List<Double> = toCollection(ArrayList<Double>())
/** Copies all elements into a [[List] */
public inline fun DoubleArray.toCollection() : Collection<Double> = toCollection(ArrayList<Double>())
public inline fun DoubleArray.toCollection() : Collection<Double> = toCollection(ArrayList<Double>())
/** Copies all elements into a [[Set]] */
public inline fun DoubleArray.toSet() : Set<Double> = toCollection(HashSet<Double>())
public inline fun DoubleArray.toSet() : Set<Double> = toCollection(HashSet<Double>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> = toCollection(TreeSet<Double>())
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> = toCollection(TreeSet<Double>())
@@ -51,7 +51,7 @@ public inline fun <R> DoubleArray.flatMap(transform: (Double)-> Collection<R>) :
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun DoubleArray.plus(element: Double): List<Double> {
public inline fun DoubleArray.plus(element: Double): List<Double> {
val list = toCollection(ArrayList<Double>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun DoubleArray.plus(element: Double): List<Double> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun DoubleArray.plus(elements: DoubleArray): List<Double> {
public inline fun DoubleArray.plus(elements: DoubleArray): List<Double> {
val list = toCollection(ArrayList<Double>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun DoubleArray.plus(elements: DoubleArray): List<Double> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun DoubleArray.requireNoNulls() : List<Double> {
public inline fun DoubleArray.requireNoNulls() : List<Double> {
val list = ArrayList<Double>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun FloatArray.reverse() : List<Float> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun FloatArray.toLinkedList() : LinkedList<Float> = toCollection(LinkedList<Float>())
public inline fun FloatArray.toLinkedList() : LinkedList<Float> = toCollection(LinkedList<Float>())
/** Copies all elements into a [[List]] */
public inline fun FloatArray.toList() : List<Float> = toCollection(ArrayList<Float>())
public inline fun FloatArray.toList() : List<Float> = toCollection(ArrayList<Float>())
/** Copies all elements into a [[List] */
public inline fun FloatArray.toCollection() : Collection<Float> = toCollection(ArrayList<Float>())
public inline fun FloatArray.toCollection() : Collection<Float> = toCollection(ArrayList<Float>())
/** Copies all elements into a [[Set]] */
public inline fun FloatArray.toSet() : Set<Float> = toCollection(HashSet<Float>())
public inline fun FloatArray.toSet() : Set<Float> = toCollection(HashSet<Float>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun FloatArray.toSortedSet() : SortedSet<Float> = toCollection(TreeSet<Float>())
public inline fun FloatArray.toSortedSet() : SortedSet<Float> = toCollection(TreeSet<Float>())
@@ -51,7 +51,7 @@ public inline fun <R> FloatArray.flatMap(transform: (Float)-> Collection<R>) : C
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun FloatArray.plus(element: Float): List<Float> {
public inline fun FloatArray.plus(element: Float): List<Float> {
val list = toCollection(ArrayList<Float>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun FloatArray.plus(element: Float): List<Float> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun FloatArray.plus(elements: FloatArray): List<Float> {
public inline fun FloatArray.plus(elements: FloatArray): List<Float> {
val list = toCollection(ArrayList<Float>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun FloatArray.plus(elements: FloatArray): List<Float> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun FloatArray.requireNoNulls() : List<Float> {
public inline fun FloatArray.requireNoNulls() : List<Float> {
val list = ArrayList<Float>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun IntArray.reverse() : List<Int> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun IntArray.toLinkedList() : LinkedList<Int> = toCollection(LinkedList<Int>())
public inline fun IntArray.toLinkedList() : LinkedList<Int> = toCollection(LinkedList<Int>())
/** Copies all elements into a [[List]] */
public inline fun IntArray.toList() : List<Int> = toCollection(ArrayList<Int>())
public inline fun IntArray.toList() : List<Int> = toCollection(ArrayList<Int>())
/** Copies all elements into a [[List] */
public inline fun IntArray.toCollection() : Collection<Int> = toCollection(ArrayList<Int>())
public inline fun IntArray.toCollection() : Collection<Int> = toCollection(ArrayList<Int>())
/** Copies all elements into a [[Set]] */
public inline fun IntArray.toSet() : Set<Int> = toCollection(HashSet<Int>())
public inline fun IntArray.toSet() : Set<Int> = toCollection(HashSet<Int>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun IntArray.toSortedSet() : SortedSet<Int> = toCollection(TreeSet<Int>())
public inline fun IntArray.toSortedSet() : SortedSet<Int> = toCollection(TreeSet<Int>())
@@ -51,7 +51,7 @@ public inline fun <R> IntArray.flatMap(transform: (Int)-> Collection<R>) : Colle
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun IntArray.plus(element: Int): List<Int> {
public inline fun IntArray.plus(element: Int): List<Int> {
val list = toCollection(ArrayList<Int>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun IntArray.plus(element: Int): List<Int> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun IntArray.plus(elements: IntArray): List<Int> {
public inline fun IntArray.plus(elements: IntArray): List<Int> {
val list = toCollection(ArrayList<Int>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun IntArray.plus(elements: IntArray): List<Int> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun IntArray.requireNoNulls() : List<Int> {
public inline fun IntArray.requireNoNulls() : List<Int> {
val list = ArrayList<Int>()
for (element in this) {
if (element == null) {
@@ -247,7 +247,7 @@ public inline fun <T, C: MutableCollection<in T>> Iterator<T>.takeWhileTo(result
}
/** Copies all elements into the given collection */
public inline fun <in T, C: MutableCollection<in T>> Iterator<T>.toCollection(result: C) : C {
public inline fun <T, C: MutableCollection<in T>> Iterator<T>.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -264,16 +264,16 @@ public inline fun <T> Iterator<T>.reverse() : List<T> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun <in T> Iterator<T>.toLinkedList() : LinkedList<T> = toCollection(LinkedList<T>())
public inline fun <T> Iterator<T>.toLinkedList() : LinkedList<T> = toCollection(LinkedList<T>())
/** Copies all elements into a [[List]] */
public inline fun <in T> Iterator<T>.toList() : List<T> = toCollection(ArrayList<T>())
public inline fun <T> Iterator<T>.toList() : List<T> = toCollection(ArrayList<T>())
/** Copies all elements into a [[List] */
public inline fun <in T> Iterator<T>.toCollection() : Collection<T> = toCollection(ArrayList<T>())
public inline fun <T> Iterator<T>.toCollection() : Collection<T> = toCollection(ArrayList<T>())
/** Copies all elements into a [[Set]] */
public inline fun <in T> Iterator<T>.toSet() : Set<T> = toCollection(HashSet<T>())
public inline fun <T> Iterator<T>.toSet() : Set<T> = toCollection(HashSet<T>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -11,5 +11,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun <in T> Iterator<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
public inline fun <T> Iterator<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
@@ -265,16 +265,16 @@ public inline fun LongArray.reverse() : List<Long> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun LongArray.toLinkedList() : LinkedList<Long> = toCollection(LinkedList<Long>())
public inline fun LongArray.toLinkedList() : LinkedList<Long> = toCollection(LinkedList<Long>())
/** Copies all elements into a [[List]] */
public inline fun LongArray.toList() : List<Long> = toCollection(ArrayList<Long>())
public inline fun LongArray.toList() : List<Long> = toCollection(ArrayList<Long>())
/** Copies all elements into a [[List] */
public inline fun LongArray.toCollection() : Collection<Long> = toCollection(ArrayList<Long>())
public inline fun LongArray.toCollection() : Collection<Long> = toCollection(ArrayList<Long>())
/** Copies all elements into a [[Set]] */
public inline fun LongArray.toSet() : Set<Long> = toCollection(HashSet<Long>())
public inline fun LongArray.toSet() : Set<Long> = toCollection(HashSet<Long>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun LongArray.toSortedSet() : SortedSet<Long> = toCollection(TreeSet<Long>())
public inline fun LongArray.toSortedSet() : SortedSet<Long> = toCollection(TreeSet<Long>())
@@ -51,7 +51,7 @@ public inline fun <R> LongArray.flatMap(transform: (Long)-> Collection<R>) : Col
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun LongArray.plus(element: Long): List<Long> {
public inline fun LongArray.plus(element: Long): List<Long> {
val list = toCollection(ArrayList<Long>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun LongArray.plus(element: Long): List<Long> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun LongArray.plus(elements: LongArray): List<Long> {
public inline fun LongArray.plus(elements: LongArray): List<Long> {
val list = toCollection(ArrayList<Long>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun LongArray.plus(elements: LongArray): List<Long> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun LongArray.requireNoNulls() : List<Long> {
public inline fun LongArray.requireNoNulls() : List<Long> {
val list = ArrayList<Long>()
for (element in this) {
if (element == null) {
@@ -265,16 +265,16 @@ public inline fun ShortArray.reverse() : List<Short> {
}
/** Copies all elements into a [[LinkedList]] */
public inline fun ShortArray.toLinkedList() : LinkedList<Short> = toCollection(LinkedList<Short>())
public inline fun ShortArray.toLinkedList() : LinkedList<Short> = toCollection(LinkedList<Short>())
/** Copies all elements into a [[List]] */
public inline fun ShortArray.toList() : List<Short> = toCollection(ArrayList<Short>())
public inline fun ShortArray.toList() : List<Short> = toCollection(ArrayList<Short>())
/** Copies all elements into a [[List] */
public inline fun ShortArray.toCollection() : Collection<Short> = toCollection(ArrayList<Short>())
public inline fun ShortArray.toCollection() : Collection<Short> = toCollection(ArrayList<Short>())
/** Copies all elements into a [[Set]] */
public inline fun ShortArray.toSet() : Set<Short> = toCollection(HashSet<Short>())
public inline fun ShortArray.toSet() : Set<Short> = toCollection(HashSet<Short>())
/**
TODO figure out necessary variance/generics ninja stuff... :)
@@ -12,5 +12,5 @@ package kotlin
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun ShortArray.toSortedSet() : SortedSet<Short> = toCollection(TreeSet<Short>())
public inline fun ShortArray.toSortedSet() : SortedSet<Short> = toCollection(TreeSet<Short>())
@@ -51,7 +51,7 @@ public inline fun <R> ShortArray.flatMap(transform: (Short)-> Collection<R>) : C
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun ShortArray.plus(element: Short): List<Short> {
public inline fun ShortArray.plus(element: Short): List<Short> {
val list = toCollection(ArrayList<Short>())
list.add(element)
return list
@@ -63,7 +63,7 @@ public inline fun ShortArray.plus(element: Short): List<Short> {
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun ShortArray.plus(elements: ShortArray): List<Short> {
public inline fun ShortArray.plus(elements: ShortArray): List<Short> {
val list = toCollection(ArrayList<Short>())
list.addAll(elements.toCollection())
return list
@@ -74,7 +74,7 @@ public inline fun ShortArray.plus(elements: ShortArray): List<Short> {
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun ShortArray.requireNoNulls() : List<Short> {
public inline fun ShortArray.requireNoNulls() : List<Short> {
val list = ArrayList<Short>()
for (element in this) {
if (element == null) {