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:
James Strachan
2012-07-05 15:49:10 +01:00
parent bea649bf87
commit b4dace2c29
59 changed files with 744 additions and 602 deletions
@@ -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 <T> Array<T>.reduceRight(operation: (T, T) -> T): T = reverse(
*/
public inline fun <T, K> Array<T>.groupBy(toKey: (T) -> K) : Map<K, List<T>> = groupByTo<T,K>(HashMap<K, List<T>>(), 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 <T, K> Array<T>.groupByTo(result: Map<K, List<T>>, toKey: (T) -> K) : Map<K, List<T>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<T>() }
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 <T> Array<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun <in T> Array<T>.toSortedList(transform: fun(T) : java.lang.Com
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 <in T> Array<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun <in T> Array<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <T, R, C: Collection<in R>> Array<T>.mapTo(result: C, transfor
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <T, R> Array<T>.map(transform : (T) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <T, R> Array<T>.map(transform : (T) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 BooleanArray.reduceRight(operation: (Boolean, Boolean) -> Bool
*/
public inline fun <K> BooleanArray.groupBy(toKey: (Boolean) -> K) : Map<K, List<Boolean>> = groupByTo<K>(HashMap<K, List<Boolean>>(), 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> BooleanArray.groupByTo(result: Map<K, List<Boolean>>, toKey: (Boolean) -> K) : Map<K, List<Boolean>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Boolean>() }
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 BooleanArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun BooleanArray.toSortedList(transform: fun(Boolean) : java.lang
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 BooleanArray.toSortedSet() : SortedSet<Boolean> = toCollection(TreeSet<Boolean>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun BooleanArray.toSortedSet() : SortedSet<Boolean> = toCollection(TreeSet<Boolean>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> BooleanArray.mapTo(result: C, transfo
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> BooleanArray.map(transform : (Boolean) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> BooleanArray.map(transform : (Boolean) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 ByteArray.reduceRight(operation: (Byte, Byte) -> Byte): Byte =
*/
public inline fun <K> ByteArray.groupBy(toKey: (Byte) -> K) : Map<K, List<Byte>> = groupByTo<K>(HashMap<K, List<Byte>>(), 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> ByteArray.groupByTo(result: Map<K, List<Byte>>, toKey: (Byte) -> K) : Map<K, List<Byte>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Byte>() }
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 ByteArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun ByteArray.toSortedList(transform: fun(Byte) : java.lang.Compa
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 ByteArray.toSortedSet() : SortedSet<Byte> = toCollection(TreeSet<Byte>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun ByteArray.toSortedSet() : SortedSet<Byte> = toCollection(TreeSet<Byte>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> ByteArray.mapTo(result: C, transform
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> ByteArray.map(transform : (Byte) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> ByteArray.map(transform : (Byte) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 CharArray.reduceRight(operation: (Char, Char) -> Char): Char =
*/
public inline fun <K> CharArray.groupBy(toKey: (Char) -> K) : Map<K, List<Char>> = groupByTo<K>(HashMap<K, List<Char>>(), 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> CharArray.groupByTo(result: Map<K, List<Char>>, toKey: (Char) -> K) : Map<K, List<Char>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Char>() }
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 CharArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun CharArray.toSortedList(transform: fun(Char) : java.lang.Compa
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 CharArray.toSortedSet() : SortedSet<Char> = toCollection(TreeSet<Char>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun CharArray.toSortedSet() : SortedSet<Char> = toCollection(TreeSet<Char>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> CharArray.mapTo(result: C, transform
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> CharArray.map(transform : (Char) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> CharArray.map(transform : (Char) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> = toCollection(TreeSet<Double>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> DoubleArray.mapTo(result: C, transfor
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> DoubleArray.map(transform : (Double) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> DoubleArray.map(transform : (Double) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 FloatArray.reduceRight(operation: (Float, Float) -> Float): Fl
*/
public inline fun <K> FloatArray.groupBy(toKey: (Float) -> K) : Map<K, List<Float>> = groupByTo<K>(HashMap<K, List<Float>>(), 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> FloatArray.groupByTo(result: Map<K, List<Float>>, toKey: (Float) -> K) : Map<K, List<Float>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Float>() }
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 FloatArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun FloatArray.toSortedList(transform: fun(Float) : java.lang.Com
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 FloatArray.toSortedSet() : SortedSet<Float> = toCollection(TreeSet<Float>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun FloatArray.toSortedSet() : SortedSet<Float> = toCollection(TreeSet<Float>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> FloatArray.mapTo(result: C, transform
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> FloatArray.map(transform : (Float) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> FloatArray.map(transform : (Float) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 IntArray.reduceRight(operation: (Int, Int) -> Int): Int = reve
*/
public inline fun <K> IntArray.groupBy(toKey: (Int) -> K) : Map<K, List<Int>> = groupByTo<K>(HashMap<K, List<Int>>(), 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> IntArray.groupByTo(result: Map<K, List<Int>>, toKey: (Int) -> K) : Map<K, List<Int>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Int>() }
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 IntArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun IntArray.toSortedList(transform: fun(Int) : java.lang.Compara
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 IntArray.toSortedSet() : SortedSet<Int> = toCollection(TreeSet<Int>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun IntArray.toSortedSet() : SortedSet<Int> = toCollection(TreeSet<Int>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> IntArray.mapTo(result: C, transform :
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> IntArray.map(transform : (Int) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> IntArray.map(transform : (Int) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -182,21 +182,27 @@ public inline fun <T> java.util.Iterator<T>.reduceRight(operation: (T, T) -> T):
*/
public inline fun <T, K> java.util.Iterator<T>.groupBy(toKey: (T) -> K) : Map<K, List<T>> = groupByTo<T,K>(HashMap<K, List<T>>(), 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 <T, K> java.util.Iterator<T>.groupByTo(result: Map<K, List<T>>, toKey: (T) -> K) : Map<K, List<T>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<T>() }
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 <T> java.util.Iterator<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -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 LongArray.reduceRight(operation: (Long, Long) -> Long): Long =
*/
public inline fun <K> LongArray.groupBy(toKey: (Long) -> K) : Map<K, List<Long>> = groupByTo<K>(HashMap<K, List<Long>>(), 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> LongArray.groupByTo(result: Map<K, List<Long>>, toKey: (Long) -> K) : Map<K, List<Long>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Long>() }
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 LongArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun LongArray.toSortedList(transform: fun(Long) : java.lang.Compa
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 LongArray.toSortedSet() : SortedSet<Long> = toCollection(TreeSet<Long>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun LongArray.toSortedSet() : SortedSet<Long> = toCollection(TreeSet<Long>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> LongArray.mapTo(result: C, transform
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> LongArray.map(transform : (Long) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> LongArray.map(transform : (Long) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 ShortArray.reduceRight(operation: (Short, Short) -> Short): Sh
*/
public inline fun <K> ShortArray.groupBy(toKey: (Short) -> K) : Map<K, List<Short>> = groupByTo<K>(HashMap<K, List<Short>>(), 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> ShortArray.groupByTo(result: Map<K, List<Short>>, toKey: (Short) -> K) : Map<K, List<Short>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<Short>() }
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 ShortArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun ShortArray.toSortedList(transform: fun(Short) : java.lang.Com
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 ShortArray.toSortedSet() : SortedSet<Short> = toCollection(TreeSet<Short>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun ShortArray.toSortedSet() : SortedSet<Short> = toCollection(TreeSet<Short>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <R, C: Collection<in R>> ShortArray.mapTo(result: C, transform
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> ShortArray.map(transform : (Short) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <R> ShortArray.map(transform : (Short) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(this.size), transform)
}
@@ -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 <T> Iterable<T>.reduceRight(operation: (T, T) -> T): T = rever
*/
public inline fun <T, K> Iterable<T>.groupBy(toKey: (T) -> K) : Map<K, List<T>> = groupByTo<T,K>(HashMap<K, List<T>>(), 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 <T, K> Iterable<T>.groupByTo(result: Map<K, List<T>>, toKey: (T) -> K) : Map<K, List<T>> {
for (element in this) {
val key = toKey(element)
val list = result.getOrPut(key) { ArrayList<T>() }
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 <T> Iterable<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
val buffer = StringBuilder()
@@ -263,17 +268,3 @@ public inline fun <in T> Iterable<T>.toSortedList(transform: fun(T) : java.lang.
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 <in T> Iterable<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
@@ -0,0 +1,16 @@
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
//
import java.util.*
/** Copies all elements into a [[SortedSet]] */
public inline fun <in T> Iterable<T>.toSortedSet() : SortedSet<T> = toCollection(TreeSet<T>())
@@ -1,6 +1,5 @@
package kotlin
import kotlin.util.*
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
@@ -26,29 +26,3 @@ public inline fun <T, R, C: Collection<in R>> Iterable<T>.mapTo(result: C, trans
result.add(transform(item))
return result
}
//
// 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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <T, R> Iterable<T>.map(transform : (T) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(), transform)
}
@@ -0,0 +1,27 @@
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
//
import java.util.*
//
// This file contains methods which are optimised for working on Collection / Array collections where the size
// could be used to implement a more optimal solution
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a new List containing the results of applying the given *transform* function to each element in this collection
*
* @includeFunctionBody ../../test/CollectionTest.kt map
*/
public inline fun <T, R> Iterable<T>.map(transform : (T) -> R) : java.util.List<R> {
return mapTo(java.util.ArrayList<R>(), transform)
}
-118
View File
@@ -1,123 +1,5 @@
package kotlin
import java.io.ByteArrayInputStream
import java.util.Arrays
import java.nio.charset.Charset
import java.util.List
import java.util.ArrayList
import jet.runtime.Intrinsic
// Array "constructor"
[Intrinsic("kotlin.arrays.array")] public inline fun <T> array(vararg t : T) : Array<T> = t
// "constructors" for primitive types array
[Intrinsic("kotlin.arrays.array")] public inline fun doubleArray(vararg content : Double) : DoubleArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun floatArray(vararg content : Float) : FloatArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun longArray(vararg content : Long) : LongArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun intArray(vararg content : Int) : IntArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun charArray(vararg content : Char) : CharArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun shortArray(vararg content : Short) : ShortArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun byteArray(vararg content : Byte) : ByteArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun booleanArray(vararg content : Boolean) : BooleanArray = content
public inline fun ByteArray.binarySearch(key: Byte) : Int = Arrays.binarySearch(this, key)
public inline fun ShortArray.binarySearch(key: Short) : Int = Arrays.binarySearch(this, key)
public inline fun IntArray.binarySearch(key: Int) : Int = Arrays.binarySearch(this, key)
public inline fun LongArray.binarySearch(key: Long) : Int = Arrays.binarySearch(this, key)
public inline fun FloatArray.binarySearch(key: Float) : Int = Arrays.binarySearch(this, key)
public inline fun DoubleArray.binarySearch(key: Double) : Int = Arrays.binarySearch(this, key)
public inline fun CharArray.binarySearch(key: Char) : Int = Arrays.binarySearch(this, key)
public inline fun ByteArray.binarySearch(fromIndex: Int, toIndex: Int, key: Byte) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun ShortArray.binarySearch(fromIndex: Int, toIndex: Int, key: Short) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun IntArray.binarySearch(fromIndex: Int, toIndex: Int, key: Int) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun LongArray.binarySearch(fromIndex: Int, toIndex: Int, key: Long) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun FloatArray.binarySearch(fromIndex: Int, toIndex: Int, key: Float) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun DoubleArray.binarySearch(fromIndex: Int, toIndex: Int, key: Double) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun CharArray.binarySearch(fromIndex: Int, toIndex: Int, key: Char) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
/*
public inline fun <T> Array<T>.binarySearch(key: T, comparator: public fun(T,T):Int) = Arrays.binarySearch(this, key, object: java.util.Comparator<T> {
public override fun compare(a: T, b: T) = comparator(a, b)
public override fun equals(obj: Any?) = obj.identityEquals(this)
})
*/
public inline fun BooleanArray.fill(value: Boolean) : Unit = Arrays.fill(this, value)
public inline fun ByteArray.fill(value: Byte) : Unit = Arrays.fill(this, value)
public inline fun ShortArray.fill(value: Short) : Unit = Arrays.fill(this, value)
public inline fun IntArray.fill(value: Int) : Unit = Arrays.fill(this, value)
public inline fun LongArray.fill(value: Long) : Unit = Arrays.fill(this, value)
public inline fun FloatArray.fill(value: Float) : Unit = Arrays.fill(this, value)
public inline fun DoubleArray.fill(value: Double) : Unit = Arrays.fill(this, value)
public inline fun CharArray.fill(value: Char) : Unit = Arrays.fill(this, value)
public inline fun <in T: Any?> Array<T>.fill(value: T) : Unit = Arrays.fill(this as Array<Any?>, value)
public inline fun ByteArray.sort() : Unit = Arrays.sort(this)
public inline fun ShortArray.sort() : Unit = Arrays.sort(this)
public inline fun IntArray.sort() : Unit = Arrays.sort(this)
public inline fun LongArray.sort() : Unit = Arrays.sort(this)
public inline fun FloatArray.sort() : Unit = Arrays.sort(this)
public inline fun DoubleArray.sort() : Unit = Arrays.sort(this)
public inline fun CharArray.sort() : Unit = Arrays.sort(this)
public inline fun ByteArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun ShortArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun IntArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun LongArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun FloatArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun DoubleArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun CharArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun BooleanArray.copyOf(newLength: Int = this.size) : BooleanArray = Arrays.copyOf(this, newLength).sure()
public inline fun ByteArray.copyOf(newLength: Int = this.size) : ByteArray = Arrays.copyOf(this, newLength).sure()
public inline fun ShortArray.copyOf(newLength: Int = this.size) : ShortArray = Arrays.copyOf(this, newLength).sure()
public inline fun IntArray.copyOf(newLength: Int = this.size) : IntArray = Arrays.copyOf(this, newLength).sure()
public inline fun LongArray.copyOf(newLength: Int = this.size) : LongArray = Arrays.copyOf(this, newLength).sure()
public inline fun FloatArray.copyOf(newLength: Int = this.size) : FloatArray = Arrays.copyOf(this, newLength).sure()
public inline fun DoubleArray.copyOf(newLength: Int = this.size) : DoubleArray = Arrays.copyOf(this, newLength).sure()
public inline fun CharArray.copyOf(newLength: Int = this.size) : CharArray = Arrays.copyOf(this, newLength).sure()
// TODO: resuling array may contain nulls even if T is non-nullable
public inline fun <T> Array<T>.copyOf(newLength: Int = this.size) : Array<T> = Arrays.copyOf(this as Array<T?>, newLength) as Array<T>
public inline fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun ByteArray.copyOfRange(from: Int, to: Int) : ByteArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun ShortArray.copyOfRange(from: Int, to: Int) : ShortArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun IntArray.copyOfRange(from: Int, to: Int) : IntArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun LongArray.copyOfRange(from: Int, to: Int) : LongArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun CharArray.copyOfRange(from: Int, to: Int) : CharArray = Arrays.copyOfRange(this, from, to).sure()
// TODO: resuling array may contain nulls even if T is non-nullable
public inline fun <T> Array<T>.copyOfRange(from: Int, to: Int) : Array<T> = Arrays.copyOfRange(this as Array<T?>, from, to) as Array<T>
public inline val ByteArray.inputStream : ByteArrayInputStream
get() = ByteArrayInputStream(this)
public inline fun ByteArray.inputStream(offset: Int, length: Int) : ByteArrayInputStream = ByteArrayInputStream(this, offset, length)
public inline fun ByteArray.toString(encoding: String?): String {
if (encoding != null) {
return String(this, encoding)
} else {
return String(this)
}
}
public inline fun ByteArray.toString(encoding: Charset) : String = String(this, encoding)
/** Returns true if the array is not empty */
public inline fun <T> Array<T>.notEmpty() : Boolean = !this.isEmpty()
+115
View File
@@ -0,0 +1,115 @@
package kotlin
import java.io.ByteArrayInputStream
import java.nio.charset.Charset
import java.util.Arrays
import jet.runtime.Intrinsic
// Array "constructor"
[Intrinsic("kotlin.arrays.array")] public inline fun <T> array(vararg t : T) : Array<T> = t
// "constructors" for primitive types array
[Intrinsic("kotlin.arrays.array")] public inline fun doubleArray(vararg content : Double) : DoubleArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun floatArray(vararg content : Float) : FloatArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun longArray(vararg content : Long) : LongArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun intArray(vararg content : Int) : IntArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun charArray(vararg content : Char) : CharArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun shortArray(vararg content : Short) : ShortArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun byteArray(vararg content : Byte) : ByteArray = content
[Intrinsic("kotlin.arrays.array")] public inline fun booleanArray(vararg content : Boolean) : BooleanArray = content
public inline fun ByteArray.binarySearch(key: Byte) : Int = Arrays.binarySearch(this, key)
public inline fun ShortArray.binarySearch(key: Short) : Int = Arrays.binarySearch(this, key)
public inline fun IntArray.binarySearch(key: Int) : Int = Arrays.binarySearch(this, key)
public inline fun LongArray.binarySearch(key: Long) : Int = Arrays.binarySearch(this, key)
public inline fun FloatArray.binarySearch(key: Float) : Int = Arrays.binarySearch(this, key)
public inline fun DoubleArray.binarySearch(key: Double) : Int = Arrays.binarySearch(this, key)
public inline fun CharArray.binarySearch(key: Char) : Int = Arrays.binarySearch(this, key)
public inline fun ByteArray.binarySearch(fromIndex: Int, toIndex: Int, key: Byte) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun ShortArray.binarySearch(fromIndex: Int, toIndex: Int, key: Short) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun IntArray.binarySearch(fromIndex: Int, toIndex: Int, key: Int) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun LongArray.binarySearch(fromIndex: Int, toIndex: Int, key: Long) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun FloatArray.binarySearch(fromIndex: Int, toIndex: Int, key: Float) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun DoubleArray.binarySearch(fromIndex: Int, toIndex: Int, key: Double) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
public inline fun CharArray.binarySearch(fromIndex: Int, toIndex: Int, key: Char) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key)
/*
public inline fun <T> Array<T>.binarySearch(key: T, comparator: public fun(T,T):Int) = Arrays.binarySearch(this, key, object: java.util.Comparator<T> {
public override fun compare(a: T, b: T) = comparator(a, b)
public override fun equals(obj: Any?) = obj.identityEquals(this)
})
*/
public inline fun BooleanArray.fill(value: Boolean) : Unit = Arrays.fill(this, value)
public inline fun ByteArray.fill(value: Byte) : Unit = Arrays.fill(this, value)
public inline fun ShortArray.fill(value: Short) : Unit = Arrays.fill(this, value)
public inline fun IntArray.fill(value: Int) : Unit = Arrays.fill(this, value)
public inline fun LongArray.fill(value: Long) : Unit = Arrays.fill(this, value)
public inline fun FloatArray.fill(value: Float) : Unit = Arrays.fill(this, value)
public inline fun DoubleArray.fill(value: Double) : Unit = Arrays.fill(this, value)
public inline fun CharArray.fill(value: Char) : Unit = Arrays.fill(this, value)
public inline fun <in T: Any?> Array<T>.fill(value: T) : Unit = Arrays.fill(this as Array<Any?>, value)
public inline fun ByteArray.sort() : Unit = Arrays.sort(this)
public inline fun ShortArray.sort() : Unit = Arrays.sort(this)
public inline fun IntArray.sort() : Unit = Arrays.sort(this)
public inline fun LongArray.sort() : Unit = Arrays.sort(this)
public inline fun FloatArray.sort() : Unit = Arrays.sort(this)
public inline fun DoubleArray.sort() : Unit = Arrays.sort(this)
public inline fun CharArray.sort() : Unit = Arrays.sort(this)
public inline fun ByteArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun ShortArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun IntArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun LongArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun FloatArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun DoubleArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun CharArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex)
public inline fun BooleanArray.copyOf(newLength: Int = this.size) : BooleanArray = Arrays.copyOf(this, newLength).sure()
public inline fun ByteArray.copyOf(newLength: Int = this.size) : ByteArray = Arrays.copyOf(this, newLength).sure()
public inline fun ShortArray.copyOf(newLength: Int = this.size) : ShortArray = Arrays.copyOf(this, newLength).sure()
public inline fun IntArray.copyOf(newLength: Int = this.size) : IntArray = Arrays.copyOf(this, newLength).sure()
public inline fun LongArray.copyOf(newLength: Int = this.size) : LongArray = Arrays.copyOf(this, newLength).sure()
public inline fun FloatArray.copyOf(newLength: Int = this.size) : FloatArray = Arrays.copyOf(this, newLength).sure()
public inline fun DoubleArray.copyOf(newLength: Int = this.size) : DoubleArray = Arrays.copyOf(this, newLength).sure()
public inline fun CharArray.copyOf(newLength: Int = this.size) : CharArray = Arrays.copyOf(this, newLength).sure()
// TODO: resuling array may contain nulls even if T is non-nullable
public inline fun <T> Array<T>.copyOf(newLength: Int = this.size) : Array<T> = Arrays.copyOf(this as Array<T?>, newLength) as Array<T>
public inline fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun ByteArray.copyOfRange(from: Int, to: Int) : ByteArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun ShortArray.copyOfRange(from: Int, to: Int) : ShortArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun IntArray.copyOfRange(from: Int, to: Int) : IntArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun LongArray.copyOfRange(from: Int, to: Int) : LongArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun CharArray.copyOfRange(from: Int, to: Int) : CharArray = Arrays.copyOfRange(this, from, to).sure()
// TODO: resuling array may contain nulls even if T is non-nullable
public inline fun <T> Array<T>.copyOfRange(from: Int, to: Int) : Array<T> = Arrays.copyOfRange(this as Array<T?>, from, to) as Array<T>
public inline val ByteArray.inputStream : ByteArrayInputStream
get() = ByteArrayInputStream(this)
public inline fun ByteArray.inputStream(offset: Int, length: Int) : ByteArrayInputStream = ByteArrayInputStream(this, offset, length)
public inline fun ByteArray.toString(encoding: String?): String {
if (encoding != null) {
return String(this, encoding)
} else {
return String(this)
}
}
public inline fun ByteArray.toString(encoding: Charset) : String = String(this, encoding)