diff --git a/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt b/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt index 4ff4bc939dd..18a3b0a19bf 100644 --- a/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt +++ b/libraries/stdlib/src/kotlin/JLangIterablesLazy.kt @@ -85,13 +85,14 @@ public inline fun java.lang.Iterable?.requireNoNulls() : List { * @includeFunctionBody ../../test/CollectionTest.kt drop */ public inline fun java.lang.Iterable.drop(n: Int): List { - fun countTo(n: Int): (T) -> Boolean { - var count = 0 - return { ++count; count <= n } - } return dropWhile(countTo(n)) } +private fun countTo(n: Int): (T) -> Boolean { + var count = 0 + return { ++count; count <= n } +} + /** * Returns a list containing the everything but the first elements that satisfy the given *predicate* * @@ -105,10 +106,6 @@ public inline fun java.lang.Iterable.dropWhile(predicate: (T) -> Boolean) * @includeFunctionBody ../../test/CollectionTest.kt take */ public inline fun java.lang.Iterable.take(n: Int): List { - fun countTo(n: Int): (T) -> Boolean { - var count = 0 - return { ++count; count <= n } - } return takeWhile(countTo(n)) } diff --git a/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt b/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt index e3deca8b2b0..2ad3a72399c 100644 --- a/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt +++ b/libraries/stdlib/src/kotlin/JLangIterablesSpecial.kt @@ -94,8 +94,7 @@ public fun java.lang.Iterable.contains(item : T) : Boolean { public fun java.lang.Iterable.withIndices() : java.lang.Iterable<#(Int, T)> { return object : java.lang.Iterable<#(Int, T)> { public override fun iterator(): java.util.Iterator<#(Int, T)> { - // TODO explicit typecast as a workaround for KT-1457, should be removed when it is fixed - return NumberedIterator(this@withIndices.iterator().sure()) as java.util.Iterator<#(Int, T)> + return NumberedIterator(this@withIndices.iterator()!!) } } }