latest code generated standard library apis

This commit is contained in:
James Strachan
2012-07-04 08:28:39 +01:00
parent 8f94f5e43f
commit b9edbea926
12 changed files with 57 additions and 123 deletions
@@ -184,27 +184,21 @@ 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()