refactored the standard library so most of the collection APIs in the standard library can be compiled to JS
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.util.*
|
||||
|
||||
//
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
|
||||
@@ -6,9 +9,6 @@
|
||||
// Generated from input file: src/kotlin/JLangIterables.kt
|
||||
//
|
||||
|
||||
package kotlin
|
||||
|
||||
import kotlin.util.*
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -232,21 +232,20 @@ public inline fun <C: Collection<Double>> DoubleArray.takeWhileTo(result: C, pre
|
||||
return result
|
||||
}
|
||||
|
||||
/** Copies all elements into the given collection */
|
||||
public inline fun <C: Collection<Double>> DoubleArray.toCollection(result: C) : C {
|
||||
for (element in this) result.add(element)
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverses the order the elements into a list
|
||||
*
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reverse
|
||||
*/
|
||||
public inline fun DoubleArray.reverse() : List<Double> {
|
||||
val answer = LinkedList<Double>()
|
||||
for (element in this) answer.addFirst(element)
|
||||
return answer
|
||||
}
|
||||
|
||||
/** Copies all elements into the given collection */
|
||||
public inline fun <C: Collection<Double>> DoubleArray.toCollection(result: C) : C {
|
||||
for (element in this) result.add(element)
|
||||
return result
|
||||
val list = toList()
|
||||
return list.reverse()
|
||||
}
|
||||
|
||||
/** Copies all elements into a [[LinkedList]] */
|
||||
@@ -258,12 +257,6 @@ public inline fun DoubleArray.toList() : List<Double> = toCollection(ArrayList<
|
||||
/** Copies all elements into a [[List] */
|
||||
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>())
|
||||
|
||||
/** Copies all elements into a [[SortedSet]] */
|
||||
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> = toCollection(TreeSet<Double>())
|
||||
|
||||
/**
|
||||
TODO figure out necessary variance/generics ninja stuff... :)
|
||||
public inline fun DoubleArray.toSortedList(transform: fun(Double) : java.lang.Comparable<*>) : List<Double> {
|
||||
@@ -272,3 +265,20 @@ public inline fun DoubleArray.toSortedList(transform: fun(Double) : java.lang.C
|
||||
return answer
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
|
||||
import java.util.*
|
||||
|
||||
/** Copies all elements into a [[Set]] */
|
||||
public inline fun DoubleArray.toSet() : Set<Double> = toCollection(HashSet<Double>())
|
||||
|
||||
/** Copies all elements into a [[SortedSet]] */
|
||||
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> = toCollection(TreeSet<Double>())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user