added a native array() function for the JS generation; also refactored the code generated collection APIs so that most of them can be used with JavaScript and included more array based APIs into the JS generation
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.util.*
|
||||
|
||||
//
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
|
||||
@@ -184,21 +183,27 @@ public inline fun DoubleArray.reduceRight(operation: (Double, Double) -> Double)
|
||||
*/
|
||||
public inline fun <K> DoubleArray.groupBy(toKey: (Double) -> K) : Map<K, List<Double>> = groupByTo<K>(HashMap<K, List<Double>>(), 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 <K> DoubleArray.groupByTo(result: Map<K, List<Double>>, toKey: (Double) -> K) : Map<K, List<Double>> {
|
||||
for (element in this) {
|
||||
val key = toKey(element)
|
||||
val list = result.getOrPut(key) { ArrayList<Double>() }
|
||||
list.add(element)
|
||||
|
||||
val some = key
|
||||
val more = some
|
||||
val onceMore = more
|
||||
val again = println(more)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string from all the elements separated using the *separator* and using the given *prefix* and *postfix* if supplied.
|
||||
*
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt makeString
|
||||
*/
|
||||
public inline fun DoubleArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
@@ -263,17 +268,3 @@ 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 [[SortedSet]] */
|
||||
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> = toCollection(TreeSet<Double>())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user