for consistency, moved extension functions on iterator/iterable/collection to the kotlin package rather than being split across kotlin and kotlin.util. Once intrinsic collections are here we could consider moving the java.util extension functions into kotlin.java.util

This commit is contained in:
James Strachan
2012-03-26 08:58:50 +01:00
parent dd9c36387c
commit 3a4ed6a85f
15 changed files with 17 additions and 22 deletions
@@ -5,7 +5,6 @@ import org.jetbrains.jet.compiler.CompileEnvironment
import org.jetbrains.jet.cli.CompilerArguments
import java.io.PrintStream
import java.io.File
import kotlin.util.orEmpty
/**
* Main for running the KDocCompiler
@@ -1,13 +1,13 @@
package kotlin.jdbc
import java.sql. *
import java.util.List
import kotlin.util.arrayList
import java.sql.*
import java.util.ArrayList
import java.util.Collection
import java.util.List
/**
* Creates an iterator through a [[ResultSet]]
*/
* Creates an iterator through a [[ResultSet]]
*/
fun ResultSet.iterator() : Iterator<ResultSet> {
val rs = this
return object : Iterator<ResultSet>{
@@ -32,7 +32,7 @@ fun ResultSet.get(columnName: String): Any? = this.getObject(columnName)
* Maps the collection of rows to some value
*/
fun <T> ResultSet.map(fn: (ResultSet) -> T) : List<T> {
val answer = arrayList<T>()
val answer = ArrayList<T>()
mapTo(answer, fn)
return answer
}
+1 -1
View File
@@ -1,4 +1,4 @@
package kotlin.util
package kotlin
import java.util.*
+1 -1
View File
@@ -1,4 +1,4 @@
package kotlin.util
package kotlin
import java.util.*
+1 -1
View File
@@ -1,4 +1,4 @@
package kotlin.util
package kotlin
import java.util.*
+1 -1
View File
@@ -1,4 +1,4 @@
package kotlin.util
package kotlin
// Number of extension function for java.lang.Iterable that shouldn't participate in auto generation
import java.util.Collection
+1 -1
View File
@@ -1,4 +1,4 @@
package kotlin.util
package kotlin
import java.util.*
import java.util.regex.Pattern
+1 -1
View File
@@ -1,4 +1,4 @@
package kotlin.util
package kotlin
import java.util.Map as JMap
import java.util.HashMap
-1
View File
@@ -1,7 +1,6 @@
package kotlin.nullable
import java.util.*
import kotlin.util.getOrPut
/** Returns true if the element is not null and matches the given predicate */
inline fun <T> T?.any(predicate: (T)-> Boolean): Boolean {
@@ -1,5 +1,5 @@
// NOTE this file is auto-generated from src/JavaCollections.kt
package kotlin.util
package kotlin
import java.util.*
@@ -1,5 +1,5 @@
// NOTE this file is auto-generated from src/JavaIterables.kt
package kotlin.util
package kotlin
import java.util.*
+2 -2
View File
@@ -63,7 +63,7 @@ fun main(args: Array<String>) {
it.replaceAll("java.lang.Iterable<T", "Iterable<T")
}
generateFile(File(outDir, "JavaUtilIteratorsFromJavaIterables.kt"), "package kotlin.util", File(srcDir, "JavaIterables.kt")) {
generateFile(File(outDir, "JavaUtilIteratorsFromJavaIterables.kt"), "package kotlin", File(srcDir, "JavaIterables.kt")) {
it.replaceAll("java.lang.Iterable<T", "java.util.Iterator<T")
}
@@ -74,7 +74,7 @@ fun main(args: Array<String>) {
it.replaceAll("java.util.Collection<T", "Array<T")
}
generateFile(File(outDir, "JavaUtilIterablesFromJavaCollections.kt"), "package kotlin.util", File(srcDir, "JavaCollections.kt")) {
generateFile(File(outDir, "JavaUtilIterablesFromJavaCollections.kt"), "package kotlin", File(srcDir, "JavaCollections.kt")) {
it.replaceAll("java.util.Collection<T", "java.lang.Iterable<T").replaceAll("(this.size)", "")
}
@@ -1,8 +1,7 @@
package regressions
// TODO comment out the next line to reproduce KT-1617
import kotlin.util.map
import kotlin.util.arrayList
//import kotlin.util.map
import java.util.Collection
import java.io.File
@@ -2,7 +2,6 @@ package regressions
import junit.framework.TestCase
import java.util.List
import kotlin.util.arrayList
class Kt1619Test: TestCase() {
@@ -2,7 +2,6 @@ package org.jetbrains.kotlin.site
import junit.framework.TestCase
import java.io.File
import kotlin.util.arrayList
import org.jetbrains.kotlin.doc.KDocArguments
import org.jetbrains.kotlin.doc.KDocCompiler