Drop deprecated sequence() and withIndices()

This commit is contained in:
Ilya Gorbunov
2015-09-29 22:28:33 +03:00
parent 1c79cf2b51
commit e54db8cd2a
7 changed files with 0 additions and 252 deletions
-153
View File
@@ -6900,87 +6900,6 @@ public fun ShortArray.withIndex(): Iterable<IndexedValue<Short>> {
return IndexingIterable { iterator() }
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun <T> Array<out T>.withIndices(): List<Pair<Int, T>> {
var index = 0
return mapTo(ArrayList<Pair<Int, T>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun BooleanArray.withIndices(): List<Pair<Int, Boolean>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Boolean>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun ByteArray.withIndices(): List<Pair<Int, Byte>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Byte>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun CharArray.withIndices(): List<Pair<Int, Char>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Char>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun DoubleArray.withIndices(): List<Pair<Int, Double>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Double>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun FloatArray.withIndices(): List<Pair<Int, Float>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Float>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun IntArray.withIndices(): List<Pair<Int, Int>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Int>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun LongArray.withIndices(): List<Pair<Int, Long>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Long>>(), { index++ to it })
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun ShortArray.withIndices(): List<Pair<Int, Short>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Short>>(), { index++ to it })
}
/**
* Returns a list containing only distinct elements from the given collection.
* The elements in the resulting list are in the same order as they were in the source collection.
@@ -10359,78 +10278,6 @@ public fun ShortArray.asSequence(): Sequence<Short> {
}
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun <T> Array<out T>.sequence(): Sequence<T> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun BooleanArray.sequence(): Sequence<Boolean> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun ByteArray.sequence(): Sequence<Byte> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun CharArray.sequence(): Sequence<Char> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun DoubleArray.sequence(): Sequence<Double> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun FloatArray.sequence(): Sequence<Float> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun IntArray.sequence(): Sequence<Int> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun LongArray.sequence(): Sequence<Long> {
return asSequence()
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun ShortArray.sequence(): Sequence<Short> {
return asSequence()
}
/**
* Returns a [List] that wraps the original array.
*/
@@ -1116,15 +1116,6 @@ public fun <T> Iterable<T>.withIndex(): Iterable<IndexedValue<T>> {
return IndexingIterable { iterator() }
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun <T> Iterable<T>.withIndices(): List<Pair<Int, T>> {
var index = 0
return mapTo(ArrayList<Pair<Int, T>>(), { index++ to it })
}
/**
* Returns a list containing only distinct elements from the given collection.
* The elements in the resulting list are in the same order as they were in the source collection.
@@ -1650,14 +1641,6 @@ public fun <T> Iterable<T>.asSequence(): Sequence<T> {
}
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun <T> Iterable<T>.sequence(): Sequence<T> {
return asSequence()
}
/**
* Returns a list containing all elements that are instances of specified type parameter R.
*/
-8
View File
@@ -180,11 +180,3 @@ public fun <K, V> Map<K, V>.asSequence(): Sequence<Map.Entry<K, V>> {
}
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun <K, V> Map<K, V>.sequence(): Sequence<Map.Entry<K, V>> {
return asSequence()
}
@@ -601,15 +601,6 @@ public fun <T> Sequence<T>.withIndex(): Sequence<IndexedValue<T>> {
return IndexingSequence(this)
}
/**
* Returns a sequence containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun <T> Sequence<T>.withIndices(): Sequence<Pair<Int, T>> {
var index = 0
return TransformingSequence(this, { index++ to it })
}
/**
* Returns a sequence containing only distinct elements from the given sequence.
* The elements in the resulting sequence are in the same order as they were in the source sequence.
@@ -989,14 +980,6 @@ public fun <T> Sequence<T>.asSequence(): Sequence<T> {
return this
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun <T> Sequence<T>.sequence(): Sequence<T> {
return this
}
/**
* Returns a sequence containing all elements that are instances of specified type parameter R.
*/
@@ -513,15 +513,6 @@ public fun String.withIndex(): Iterable<IndexedValue<Char>> {
return IndexingIterable { iterator() }
}
/**
* Returns a list containing pairs of each element of the original collection and their index.
*/
@Deprecated("Use withIndex() instead.")
public fun String.withIndices(): List<Pair<Int, Char>> {
var index = 0
return mapTo(ArrayList<Pair<Int, Char>>(), { index++ to it })
}
/**
* Returns `true` if all elements match the given [predicate].
*/
@@ -771,11 +762,3 @@ public fun String.asSequence(): Sequence<Char> {
}
}
/**
* Returns a sequence from the given collection
*/
@Deprecated("Use asSequence() instead", ReplaceWith("asSequence()"))
public fun String.sequence(): Sequence<Char> {
return asSequence()
}
@@ -5,27 +5,6 @@ import templates.Family.*
fun mapping(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>()
templates add f("withIndices()") {
deprecate { "Use withIndex() instead." }
doc { "Returns a list containing pairs of each element of the original collection and their index." }
returns("List<Pair<Int, T>>")
body {
"""
var index = 0
return mapTo(ArrayList<Pair<Int, T>>(), { index++ to it })
"""
}
returns(Sequences) { "Sequence<Pair<Int, T>>" }
doc(Sequences) { "Returns a sequence containing pairs of each element of the original collection and their index." }
body(Sequences) {
"""
var index = 0
return TransformingSequence(this, { index++ to it })
"""
}
}
templates add f("withIndex()") {
doc { "Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection." }
returns("Iterable<IndexedValue<T>>")
@@ -5,25 +5,6 @@ import templates.Family.*
fun sequences(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>()
templates add f("sequence()") {
include(Maps)
exclude(Sequences)
deprecate { "Use asSequence() instead" }
deprecateReplacement { "asSequence()" }
doc { "Returns a sequence from the given collection" }
returns("Sequence<T>")
body {
"""
return asSequence()
"""
}
body(Sequences) {
"""
return this
"""
}
}
templates add f("asSequence()") {
include(Maps)
doc { "Returns a sequence from the given collection." }