Drop deprecated sequence() and withIndices()
This commit is contained in:
@@ -6900,87 +6900,6 @@ public fun ShortArray.withIndex(): Iterable<IndexedValue<Short>> {
|
|||||||
return IndexingIterable { iterator() }
|
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.
|
* 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.
|
* 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.
|
* Returns a [List] that wraps the original array.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1116,15 +1116,6 @@ public fun <T> Iterable<T>.withIndex(): Iterable<IndexedValue<T>> {
|
|||||||
return IndexingIterable { iterator() }
|
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.
|
* 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.
|
* 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.
|
* Returns a list containing all elements that are instances of specified type parameter R.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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)
|
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.
|
* 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.
|
* 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
|
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.
|
* 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() }
|
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].
|
* 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> {
|
fun mapping(): List<GenericFunction> {
|
||||||
val templates = arrayListOf<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()") {
|
templates add f("withIndex()") {
|
||||||
doc { "Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection." }
|
doc { "Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection." }
|
||||||
returns("Iterable<IndexedValue<T>>")
|
returns("Iterable<IndexedValue<T>>")
|
||||||
|
|||||||
@@ -5,25 +5,6 @@ import templates.Family.*
|
|||||||
fun sequences(): List<GenericFunction> {
|
fun sequences(): List<GenericFunction> {
|
||||||
val templates = arrayListOf<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()") {
|
templates add f("asSequence()") {
|
||||||
include(Maps)
|
include(Maps)
|
||||||
doc { "Returns a sequence from the given collection." }
|
doc { "Returns a sequence from the given collection." }
|
||||||
|
|||||||
Reference in New Issue
Block a user