Deprecate toGenerator and toLinkedList extensions.

This commit is contained in:
Ilya Gorbunov
2015-10-29 20:54:06 +03:00
parent 0997f78764
commit 3a82225201
6 changed files with 26 additions and 13 deletions
+18 -9
View File
@@ -5450,64 +5450,73 @@ public fun ShortArray.toHashSet(): HashSet<Short> {
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun <T> Array<out T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun BooleanArray.toLinkedList(): LinkedList<Boolean> {
return toCollection(LinkedList<Boolean>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun ByteArray.toLinkedList(): LinkedList<Byte> {
return toCollection(LinkedList<Byte>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun CharArray.toLinkedList(): LinkedList<Char> {
return toCollection(LinkedList<Char>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun DoubleArray.toLinkedList(): LinkedList<Double> {
return toCollection(LinkedList<Double>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun FloatArray.toLinkedList(): LinkedList<Float> {
return toCollection(LinkedList<Float>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun IntArray.toLinkedList(): LinkedList<Int> {
return toCollection(LinkedList<Int>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun LongArray.toLinkedList(): LinkedList<Long> {
return toCollection(LinkedList<Long>())
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun ShortArray.toLinkedList(): LinkedList<Short> {
return toCollection(LinkedList<Short>())
return toCollection(LinkedList())
}
/**
@@ -962,8 +962,9 @@ public fun <T> Iterable<T>.toHashSet(): HashSet<T> {
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun <T> Iterable<T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>())
return toCollection(LinkedList())
}
/**
+2 -1
View File
@@ -489,8 +489,9 @@ public fun <T> Sequence<T>.toHashSet(): HashSet<T> {
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun <T> Sequence<T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>())
return toCollection(LinkedList())
}
/**
+2 -1
View File
@@ -375,8 +375,9 @@ public fun String.toHashSet(): HashSet<Char> {
/**
* Returns a [LinkedList] containing all elements.
*/
@Deprecated("Use toCollection(LinkedList()) instead.", ReplaceWith("toCollection(LinkedList())"))
public fun String.toLinkedList(): LinkedList<Char> {
return toCollection(LinkedList<Char>())
return toCollection(LinkedList())
}
/**
@@ -5,6 +5,7 @@ package kotlin
* The generator function calls this function, passing to it either [initialValue] on the first iteration
* or the previously returned value on subsequent iterations, and returns the returned value.
*/
@Deprecated("This function will be removed soon. If you need generator function to create a sequence, use the 'sequence' function instead.")
public fun <T: Any> Function1<T, T?>.toGenerator(initialValue: T): Function0<T?> {
var nextValue: T? = initialValue
return {
@@ -90,7 +90,7 @@ fun snapshots(): List<GenericFunction> {
templates add f("toLinkedList()") {
doc { "Returns a [LinkedList] containing all elements." }
returns("LinkedList<T>")
body { "return toCollection(LinkedList<T>())" }
deprecate { Deprecation("Use toCollection(LinkedList()) instead.", replaceWith = "toCollection(LinkedList())") }
}
templates add f("toMap(selector: (T) -> K)") {