Drop hidden declarations provided for binary compatibility

This commit is contained in:
Ilya Gorbunov
2016-01-14 23:16:12 +03:00
parent 264c9a0fc9
commit 85a02d40c6
25 changed files with 63 additions and 2092 deletions
-135
View File
@@ -5770,51 +5770,6 @@ public fun ShortArray.toList(): List<Short> {
return this.toArrayList()
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <T, K> Array<out T>.toMap(selector: (T) -> K): Map<K, T> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> BooleanArray.toMap(selector: (Boolean) -> K): Map<K, Boolean> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> ByteArray.toMap(selector: (Byte) -> K): Map<K, Byte> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> CharArray.toMap(selector: (Char) -> K): Map<K, Char> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> DoubleArray.toMap(selector: (Double) -> K): Map<K, Double> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> FloatArray.toMap(selector: (Float) -> K): Map<K, Float> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> IntArray.toMap(selector: (Int) -> K): Map<K, Int> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> LongArray.toMap(selector: (Long) -> K): Map<K, Long> {
return toMapBy(selector)
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <K> ShortArray.toMap(selector: (Short) -> K): Map<K, Short> {
return toMapBy(selector)
}
/**
* Returns a [Map] containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given array.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
@@ -10613,51 +10568,6 @@ public fun <A : Appendable> ShortArray.joinTo(buffer: A, separator: CharSequence
return buffer
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T, A : Appendable> Array<out T>.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((T) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> BooleanArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Boolean) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> ByteArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Byte) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> CharArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Char) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> DoubleArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Double) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> FloatArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Float) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> IntArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Int) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> LongArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Long) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <A : Appendable> ShortArray.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Short) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
/**
* Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
@@ -10739,51 +10649,6 @@ public fun ShortArray.joinToString(separator: CharSequence = ", ", prefix: CharS
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> Array<out T>.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((T) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun BooleanArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Boolean) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun ByteArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Byte) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun CharArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Char) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun DoubleArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Double) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun FloatArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Float) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun IntArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Int) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun LongArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Long) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun ShortArray.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((Short) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
/**
* Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.
*/
@@ -1057,11 +1057,6 @@ public fun <T> Iterable<T>.toList(): List<T> {
return this.toArrayList()
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <T, K> Iterable<T>.toMap(selector: (T) -> K): Map<K, T> {
return toMapBy(selector)
}
/**
* Returns a [Map] containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
@@ -1787,11 +1782,6 @@ public fun <T, A : Appendable> Iterable<T>.joinTo(buffer: A, separator: CharSequ
return buffer
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T, A : Appendable> Iterable<T>.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((T) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
/**
* Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
@@ -1801,11 +1791,6 @@ public fun <T> Iterable<T>.joinToString(separator: CharSequence = ", ", prefix:
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> Iterable<T>.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((T) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
/**
* Returns this collection as an [Iterable].
*/
@@ -515,11 +515,6 @@ public fun <T> Sequence<T>.toList(): List<T> {
return this.toArrayList()
}
@Deprecated("Use toMapBy instead.", ReplaceWith("toMapBy(selector)"), level = DeprecationLevel.HIDDEN)
public inline fun <T, K> Sequence<T>.toMap(selector: (T) -> K): Map<K, T> {
return toMapBy(selector)
}
/**
* Returns a [Map] containing the values provided by [transform] and indexed by [selector] functions applied to elements of the given sequence.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
@@ -1099,11 +1094,6 @@ public fun <T, A : Appendable> Sequence<T>.joinTo(buffer: A, separator: CharSequ
return buffer
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T, A : Appendable> Sequence<T>.joinTo(buffer: A, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((T) -> String)? = null): A {
return joinTo(buffer, separator, prefix, postfix, limit, truncated, transform)
}
/**
* Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
@@ -1113,11 +1103,6 @@ public fun <T> Sequence<T>.joinToString(separator: CharSequence = ", ", prefix:
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> Sequence<T>.joinToString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...", transform: ((T) -> String)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
}
/**
* Creates an [Iterable] instance that wraps the original sequence returning its elements when being iterated.
*/
File diff suppressed because it is too large Load Diff
@@ -1,8 +0,0 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("TestAssertionsKt")
package kotlin.test
@Deprecated("For binary compatibility here.", level = DeprecationLevel.HIDDEN)
fun fail(message: String? = null) {
throw AssertionError(message ?: "")
}
@@ -6,27 +6,6 @@ package kotlin.collections
import java.util.*
/**
* Returns an array with the specified [size], where each element is calculated by calling the specified
* [init] function. The `init` function returns an array element given its index.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <reified T> Array(size: Int, init: (Int) -> T): Array<T> {
val result = arrayOfNulls<T>(size)
for (i in 0..size - 1) {
result[i] = init(i)
}
return result as Array<T>
}
/**
* Returns an empty array of the specified type [T].
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <reified T> emptyArray(): Array<T> = arrayOfNulls<T>(0) as Array<T>
/**
* Returns a single list of all elements from all arrays in the given array.
*/
@@ -6,62 +6,6 @@ package kotlin.collections
import java.io.ByteArrayInputStream
import java.nio.charset.Charset
// Array "constructor"
/**
* Returns an array containing the specified elements.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <reified T> arrayOf(vararg elements: T) : Array<T> = elements as Array<T>
// "constructors" for primitive types array
/**
* Returns an array containing the specified [Double] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun doubleArrayOf(vararg elements: Double) : DoubleArray = elements
/**
* Returns an array containing the specified [Float] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun floatArrayOf(vararg elements: Float) : FloatArray = elements
/**
* Returns an array containing the specified [Long] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun longArrayOf(vararg elements: Long) : LongArray = elements
/**
* Returns an array containing the specified [Int] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun intArrayOf(vararg elements: Int) : IntArray = elements
/**
* Returns an array containing the specified characters.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun charArrayOf(vararg elements: Char) : CharArray = elements
/**
* Returns an array containing the specified [Short] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun shortArrayOf(vararg elements: Short) : ShortArray = elements
/**
* Returns an array containing the specified [Byte] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun byteArrayOf(vararg elements: Byte) : ByteArray = elements
/**
* Returns an array containing the specified boolean values.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun booleanArrayOf(vararg elements: Boolean) : BooleanArray = elements
/**
* Converts the contents of this byte array to a string using the specified [charset].
*/
@@ -18,10 +18,6 @@ public operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit {
put(key, value)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
@JvmName("set")
public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = put(key, value)
/**
* getOrPut is not supported on [ConcurrentMap] since it cannot be implemented correctly in terms of concurrency.
* Use [concurrentGetOrPut] instead, or cast this to a [MutableMap] if you want to sacrifice the concurrent-safety.
@@ -206,14 +206,6 @@ public fun <T> MutableCollection<in T>.addAll(elements: Iterable<T>): Boolean {
}
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.addAll(elements: Iterable<T>) {
when (elements) {
is Collection -> addAll(elements)
else -> for (item in elements) add(item)
}
}
/**
* Adds all elements of the given [elements] sequence to this [MutableCollection].
*/
@@ -225,11 +217,6 @@ public fun <T> MutableCollection<in T>.addAll(elements: Sequence<T>): Boolean {
return result
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.addAll(elements: Sequence<T>) {
for (item in elements) add(item)
}
/**
* Adds all elements of the given [elements] array to this [MutableCollection].
*/
@@ -237,11 +224,6 @@ public fun <T> MutableCollection<in T>.addAll(elements: Array<out T>): Boolean {
return addAll(elements.asList())
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.addAll(elements: Array<out T>) {
addAll(elements.asList())
}
/**
* Removes all elements from this [MutableIterable] that match the given [predicate].
*/
@@ -304,11 +286,6 @@ public fun <T> MutableCollection<in T>.removeAll(elements: Iterable<T>): Boolean
return removeAll(elements.convertToSetForSetOperationWith(this))
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.removeAll(elements: Iterable<T>) {
removeAll(elements.convertToSetForSetOperationWith(this))
}
/**
* Removes all elements from this [MutableCollection] that are also contained in the given [elements] sequence.
*/
@@ -317,13 +294,6 @@ public fun <T> MutableCollection<in T>.removeAll(elements: Sequence<T>): Boolean
return set.isNotEmpty() && removeAll(set)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.removeAll(elements: Sequence<T>) {
val set = elements.toHashSet()
if (set.isNotEmpty())
removeAll(set)
}
/**
* Removes all elements from this [MutableCollection] that are also contained in the given [elements] array.
*/
@@ -331,14 +301,6 @@ public fun <T> MutableCollection<in T>.removeAll(elements: Array<out T>): Boolea
return elements.isNotEmpty() && removeAll(elements.toHashSet())
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.removeAll(elements: Array<out T>) {
if (elements.isNotEmpty())
removeAll(elements.toHashSet())
// else
// removeAll(emptyList())
}
/**
* Retains only elements of this [MutableCollection] that are contained in the given [elements] collection.
*/
@@ -346,11 +308,6 @@ public fun <T> MutableCollection<in T>.retainAll(elements: Iterable<T>): Boolean
return retainAll(elements.convertToSetForSetOperationWith(this))
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.retainAll(elements: Iterable<T>) {
retainAll(elements.convertToSetForSetOperationWith(this))
}
/**
* Retains only elements of this [MutableCollection] that are contained in the given [elements] array.
*/
@@ -361,15 +318,6 @@ public fun <T> MutableCollection<in T>.retainAll(elements: Array<out T>): Boolea
return retainNothing()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.retainAll(elements: Array<out T>) {
if (elements.isNotEmpty())
retainAll(elements.toHashSet())
else
clear()
// retainAll(emptyList())
}
/**
* Retains only elements of this [MutableCollection] that are contained in the given [elements] sequence.
*/
@@ -381,15 +329,6 @@ public fun <T> MutableCollection<in T>.retainAll(elements: Sequence<T>): Boolean
return retainNothing()
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun <T> MutableCollection<in T>.retainAll(elements: Sequence<T>) {
val set = elements.toHashSet()
if (set.isNotEmpty())
retainAll(set)
else
clear()
}
private fun MutableCollection<*>.retainNothing(): Boolean {
val result = isNotEmpty()
clear()
-74
View File
@@ -1,74 +0,0 @@
@file:JvmVersion
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("OperationsKt")
package kotlin.math
import java.math.BigDecimal
import java.math.BigInteger
/**
* Enables the use of the `+` operator for [BigInteger] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.plus(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigInteger.plus(other: BigInteger) : BigInteger = this.add(other)
/**
* Enables the use of the `-` operator for [BigInteger] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.minus(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigInteger.minus(other: BigInteger) : BigInteger = this.subtract(other)
/**
* Enables the use of the `*` operator for [BigInteger] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.times(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigInteger.times(other: BigInteger) : BigInteger = this.multiply(other)
/**
* Enables the use of the `/` operator for [BigInteger] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.div(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigInteger.div(other: BigInteger) : BigInteger = this.divide(other)
/**
* Enables the use of the unary `-` operator for [BigInteger] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.unaryMinus()"), level = DeprecationLevel.HIDDEN)
public operator fun BigInteger.unaryMinus() : BigInteger = this.negate()
/**
* Enables the use of the `+` operator for [BigDecimal] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.plus(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigDecimal.plus(other: BigDecimal) : BigDecimal = this.add(other)
/**
* Enables the use of the `-` operator for [BigDecimal] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.minus(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigDecimal.minus(other: BigDecimal) : BigDecimal = this.subtract(other)
/**
* Enables the use of the `*` operator for [BigDecimal] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.times(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigDecimal.times(other: BigDecimal) : BigDecimal = this.multiply(other)
/**
* Enables the use of the `/` operator for [BigDecimal] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.div(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigDecimal.div(other: BigDecimal) : BigDecimal = this.divide(other)
/**
* Enables the use of the `%` operator for [BigDecimal] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.mod(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigDecimal.mod(other: BigDecimal) : BigDecimal = this.remainder(other)
/**
* Enables the use of the unary `-` operator for [BigDecimal] instances.
*/
@Deprecated("Provided for binary compatibility", ReplaceWith("this.unaryMinus(other)"), level = DeprecationLevel.HIDDEN)
public operator fun BigDecimal.unaryMinus() : BigDecimal = this.negate()
@@ -1,39 +0,0 @@
@file:kotlin.jvm.JvmName("MapAccessorsKt")
package kotlin.properties
import kotlin.reflect.KProperty
import kotlin.internal.Exact
/**
* Returns the value of the property for the given object from this read-only map.
* @param thisRef the object for which the value is requested (not used).
* @param property the metadata for the property, used to get the name of property and lookup the value corresponding to this name in the map.
* @return the property value.
*
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public operator fun <V, V1: V> Map<in String, @Exact V>.getValue(thisRef: Any?, property: KProperty<*>): V1 = getOrImplicitDefault(property.name) as V1
/**
* Returns the value of the property for the given object from this mutable map.
* @param thisRef the object for which the value is requested (not used).
* @param property the metadata for the property, used to get the name of property and lookup the value corresponding to this name in the map.
* @return the property value.
*
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
*/
@kotlin.jvm.JvmName("getVar")
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public operator fun <V> MutableMap<in String, in V>.getValue(thisRef: Any?, property: KProperty<*>): V = getOrImplicitDefault(property.name) as V
/**
* Stores the value of the property for the given object in this mutable map.
* @param thisRef the object for which the value is requested (not used).
* @param property the metadata for the property, used to get the name of property and store the value associated with that name in the map.
* @param value the value to set.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public operator fun <V> MutableMap<in String, in V>.setValue(thisRef: Any?, property: KProperty<*>, value: V) {
this.put(property.name, value)
}
-42
View File
@@ -57,45 +57,3 @@ public fun Char.isLowSurrogate(): Boolean = this in Char.MIN_LOW_SURROGATE..Char
* Returns `true` if this character is a Unicode surrogate code unit.
*/
public fun Char.isSurrogate(): Boolean = this in Char.MIN_SURROGATE..Char.MAX_SURROGATE
/**
* The minimum value of a Unicode high-surrogate code unit.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val Char.Companion.MIN_HIGH_SURROGATE: Char
get() = '\uD800'
/**
* The maximum value of a Unicode high-surrogate code unit.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val Char.Companion.MAX_HIGH_SURROGATE: Char
get() = '\uDBFF'
/**
* The minimum value of a Unicode low-surrogate code unit.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val Char.Companion.MIN_LOW_SURROGATE: Char
get() = '\uDC00'
/**
* The maximum value of a Unicode low-surrogate code unit.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val Char.Companion.MAX_LOW_SURROGATE: Char
get() = '\uDFFF'
/**
* The minimum value of a Unicode surrogate code unit.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val Char.Companion.MIN_SURROGATE: Char
get() = MIN_HIGH_SURROGATE
/**
* The maximum value of a Unicode surrogate code unit.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val Char.Companion.MAX_SURROGATE: Char
get() = MAX_LOW_SURROGATE
@@ -1,578 +0,0 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
package kotlin.text
import java.util.NoSuchElementException
import kotlin.text.MatchResult
import kotlin.text.Regex
/** Returns `true` if the string is not `null` and not empty */
@Deprecated("Use !isNullOrEmpty() or isNullOrEmpty().not() for nullable strings.", ReplaceWith("this != null && this.isNotEmpty()"), DeprecationLevel.ERROR)
@kotlin.jvm.JvmName("isNotEmptyNullable")
public fun CharSequence?.isNotEmpty(): Boolean = this != null && this.length() > 0
/** Returns `true` if the string is not `null` and not empty */
@Deprecated("Use !isNullOrEmpty() or isNullOrEmpty().not() for nullable strings.", ReplaceWith("this != null && this.isNotEmpty()"), DeprecationLevel.HIDDEN)
@kotlin.jvm.JvmName("isNotEmptyNullable")
public fun String?.isNotEmpty(): Boolean = this != null && this.length() > 0
/**
* Returns `true` if this nullable string is either `null` or empty.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String?.isNullOrEmpty(): Boolean = this == null || this.length() == 0
/**
* Returns `true` if this string is empty (contains no characters).
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.isEmpty(): Boolean = length() == 0
/**
* Returns `true` if this string is not empty.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.isNotEmpty(): Boolean = length() > 0
// implemented differently in JVM and JS
//public fun String.isBlank(): Boolean = length() == 0 || all { it.isWhitespace() }
/**
* Returns `true` if this string is not empty and contains some characters except of whitespace characters.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.isNotBlank(): Boolean = !isBlank()
/**
* Returns `true` if this nullable string is either `null` or empty or consists solely of whitespace characters.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String?.isNullOrBlank(): Boolean = this == null || this.isBlank()
/**
* Returns the range of valid character indices for this string.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val String.indices: IntRange
get() = 0..length() - 1
/**
* Returns the index of the last character in the String or -1 if the String is empty.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val String.lastIndex: Int
get() = this.length() - 1
/*
/**
* Returns a substring before the first occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringBefore(delimiter: Char, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(0, index)
}
/**
* Returns a substring before the first occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringBefore(delimiter: String, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(0, index)
}
/**
* Returns a substring after the first occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringAfter(delimiter: Char, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(index + 1, length())
}
/**
* Returns a substring after the first occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringAfter(delimiter: String, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(index + delimiter.length(), length())
}
/**
* Returns a substring before the last occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringBeforeLast(delimiter: Char, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(0, index)
}
/**
* Returns a substring before the last occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringBeforeLast(delimiter: String, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(0, index)
}
/**
* Returns a substring after the last occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringAfterLast(delimiter: Char, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(index + 1, length())
}
/**
* Returns a substring after the last occurrence of [delimiter].
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.substringAfterLast(delimiter: String, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else substring(index + delimiter.length(), length())
}
/**
* Replace part of string before the first occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceBefore(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)
}
/**
* Replace part of string before the first occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceBefore(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)
}
/**
* Replace part of string after the first occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceAfter(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length(), replacement)
}
/**
* Replace part of string after the first occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceAfter(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {
val index = indexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length(), length(), replacement)
}
/**
* Replace part of string after the last occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceAfterLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length(), length(), replacement)
}
/**
* Replace part of string after the last occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceAfterLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length(), replacement)
}
/**
* Replace part of string before the last occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceBeforeLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)
}
/**
* Replace part of string before the last occurrence of given delimiter with the [replacement] string.
* If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.
*/
public fun String.replaceBeforeLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {
val index = lastIndexOf(delimiter)
return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)
}
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.replaceRange(firstIndex: Int, lastIndex: Int, replacement: String): String
= replaceRange(firstIndex, lastIndex, replacement)
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.replaceRange(range: IntRange, replacement: String): String
= replaceRange(range.start, range.end + 1, replacement)
private val IntRange.end: Int get() = endInclusive
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.removePrefix(prefix: String): String = removePrefix(prefix)
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.removeSuffix(suffix: String): String = removeSuffix(suffix)
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.removeSurrounding(prefix: String, suffix: String): String = removeSurrounding(prefix, suffix)
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.removeSurrounding(delimiter: String): String = removeSurrounding(delimiter, delimiter)
/**
* Returns a new string obtained by replacing each substring of this string that matches the given regular expression
* with the given [replacement].
*
* The [replacement] can consist of any combination of literal text and $-substitutions. To treat the replacement string
* literally escape it with the [kotlin.text.Regex.Companion.escapeReplacement] method.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.replace(regex: Regex, replacement: String): String = regex.replace(this, replacement)
/**
* Returns a new string obtained by replacing each substring of this string that matches the given regular expression
* with the result of the given function [transform] that takes [MatchResult] and returns a string to be used as a
* replacement for that match.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.replace(regex: Regex, transform: (MatchResult) -> String): String = regex.replace(this, transform)
/**
* Replaces the first occurrence of the given regular expression [regex] in this string with specified [replacement] expression.
*
* @param replacement A replacement expression that can include substitutions. See [Regex.replaceFirst] for details.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.replaceFirst(regex: Regex, replacement: String): String = regex.replaceFirst(this, replacement)
/**
* Returns `true` if this string matches the given regular expression.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.matches(regex: Regex): Boolean = regex.matches(this)
/**
* Returns `true` if this string starts with the specified character.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.startsWith(char: Char, ignoreCase: Boolean = false): Boolean =
this.length() > 0 && this[0].equals(char, ignoreCase)
/**
* Returns `true` if this string ends with the specified character.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.endsWith(char: Char, ignoreCase: Boolean = false): Boolean =
this.length() > 0 && this[lastIndex].equals(char, ignoreCase)
// indexOfAny()
private fun String.findAnyOf(chars: CharArray, startIndex: Int, ignoreCase: Boolean, last: Boolean): Pair<Int, Char>? {
if (!ignoreCase && chars.size() == 1) {
val char = chars.single()
val index = if (!last) nativeIndexOf(char, startIndex) else nativeLastIndexOf(char, startIndex)
return if (index < 0) null else index to char
}
val indices = if (!last) Math.max(startIndex, 0)..lastIndex else Math.min(startIndex, lastIndex) downTo 0
for (index in indices) {
val charAtIndex = get(index)
val matchingCharIndex = chars.indexOfFirst { it.equals(charAtIndex, ignoreCase) }
if (matchingCharIndex >= 0)
return index to chars[matchingCharIndex]
}
return null
}
/**
* Finds the index of the first occurrence of any of the specified [chars] in this string, starting from the specified [startIndex] and
* optionally ignoring the case.
*
* @param ignoreCase `true` to ignore character case when matching a character. By default `false`.
* @returns An index of the first occurrence of matched character from [chars] or -1 if none of [chars] are found.
*
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.indexOfAny(chars: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false): Int =
findAnyOf(chars, startIndex, ignoreCase, last = false)?.first ?: -1
/**
* Finds the index of the last occurrence of any of the specified [chars] in this string, starting from the specified [startIndex] and
* optionally ignoring the case.
*
* @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.
* @param ignoreCase `true` to ignore character case when matching a character. By default `false`.
* @returns An index of the last occurrence of matched character from [chars] or -1 if none of [chars] are found.
*
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.lastIndexOfAny(chars: CharArray, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int =
findAnyOf(chars, startIndex, ignoreCase, last = true)?.first ?: -1
private fun String.findAnyOf(strings: Collection<String>, startIndex: Int, ignoreCase: Boolean, last: Boolean): Pair<Int, String>? {
if (!ignoreCase && strings.size() == 1) {
val string = strings.single()
val index = if (!last) nativeIndexOf(string, startIndex) else nativeLastIndexOf(string, startIndex)
return if (index < 0) null else index to string
}
val indices = if (!last) Math.max(startIndex, 0)..length() else Math.min(startIndex, lastIndex) downTo 0
for (index in indices) {
val matchingString = strings.firstOrNull { it.regionMatches(0, this, index, it.length(), ignoreCase) }
if (matchingString != null)
return index to matchingString
}
return null
}
/**
* Finds the first occurrence of any of the specified [strings] in this string, starting from the specified [startIndex] and
* optionally ignoring the case.
*
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
* @returns A pair of an index of the first occurrence of matched string from [strings] and the string matched or `null` if none of [strings] are found.
*
* To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from
* the beginning to the end of this string, and finds at each position the first element in [strings]
* that matches this string at that position.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.findAnyOf(strings: Collection<String>, startIndex: Int = 0, ignoreCase: Boolean = false): Pair<Int, String>? =
findAnyOf(strings, startIndex, ignoreCase, last = false)
/**
* Finds the last occurrence of any of the specified [strings] in this string, starting from the specified [startIndex] and
* optionally ignoring the case.
*
* @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
* @returns A pair of an index of the last occurrence of matched string from [strings] and the string matched or `null` if none of [strings] are found.
*
* To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from
* the end toward the beginning of this string, and finds at each position the first element in [strings]
* that matches this string at that position.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.findLastAnyOf(strings: Collection<String>, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Pair<Int, String>? =
findAnyOf(strings, startIndex, ignoreCase, last = true)
/**
* Finds the index of the first occurrence of any of the specified [strings] in this string, starting from the specified [startIndex] and
* optionally ignoring the case.
*
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
* @returns An index of the first occurrence of matched string from [strings] or -1 if none of [strings] are found.
*
* To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from
* the beginning to the end of this string, and finds at each position the first element in [strings]
* that matches this string at that position.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.indexOfAny(strings: Collection<String>, startIndex: Int = 0, ignoreCase: Boolean = false): Int =
findAnyOf(strings, startIndex, ignoreCase, last = false)?.first ?: -1
/**
* Finds the index of the last occurrence of any of the specified [strings] in this string, starting from the specified [startIndex] and
* optionally ignoring the case.
*
* @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
* @returns An index of the last occurrence of matched string from [strings] or -1 if none of [strings] are found.
*
* To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from
* the end toward the beginning of this string, and finds at each position the first element in [strings]
* that matches this string at that position.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.lastIndexOfAny(strings: Collection<String>, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int =
findAnyOf(strings, startIndex, ignoreCase, last = true)?.first ?: -1
// indexOf
/**
* Returns the index within this string of the first occurrence of the specified character, starting from the specified [startIndex].
*
* @param ignoreCase `true` to ignore character case when matching a character. By default `false`.
* @returns An index of the first occurrence of [char] or -1 if none is found.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int {
return if (ignoreCase)
indexOfAny(charArrayOf(char), startIndex, ignoreCase)
else
nativeIndexOf(char, startIndex)
}
/**
* Returns the index within this string of the first occurrence of the specified [string], starting from the specified [startIndex].
*
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
* @returns An index of the first occurrence of [string] or -1 if none is found.
*/
@kotlin.jvm.JvmOverloads
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.indexOf(string: String, startIndex: Int = 0, ignoreCase: Boolean = false): Int {
return if (ignoreCase)
indexOfAny(listOf(string), startIndex, ignoreCase)
else
nativeIndexOf(string, startIndex)
}
/**
* Returns the index within this string of the last occurrence of the specified character, starting from the specified [startIndex].
*
* @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.
* @param ignoreCase `true` to ignore character case when matching a character. By default `false`.
* @returns An index of the first occurrence of [char] or -1 if none is found.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.lastIndexOf(char: Char, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int {
return if (ignoreCase)
lastIndexOfAny(charArrayOf(char), startIndex, ignoreCase)
else
nativeLastIndexOf(char, startIndex)
}
/**
* Returns the index within this string of the last occurrence of the specified [string], starting from the specified [startIndex].
*
* @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
* @returns An index of the first occurrence of [string] or -1 if none is found.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.lastIndexOf(string: String, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int {
return if (ignoreCase)
lastIndexOfAny(listOf(string), startIndex, ignoreCase)
else
nativeLastIndexOf(string, startIndex)
}
/**
* Returns `true` if this string contains the specified sequence of characters as a substring.
*
* @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public operator fun String.contains(seq: CharSequence, ignoreCase: Boolean = false): Boolean =
indexOf(seq.toString(), ignoreCase = ignoreCase) >= 0
/**
* Returns `true` if this string contains the specified character.
*
* @param ignoreCase `true` to ignore character case when comparing characters. By default `false`.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public operator fun String.contains(char: Char, ignoreCase: Boolean = false): Boolean =
indexOf(char, ignoreCase = ignoreCase) >= 0
// split
/**
* Splits this string to a sequence of strings around occurrences of the specified [delimiters].
*
* @param delimiters One or more strings to be used as delimiters.
* @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.
* @param limit The maximum number of substrings to return. Zero by default means no limit is set.
*
* To avoid ambiguous results when strings in [delimiters] have characters in common, this method proceeds from
* the beginning to the end of this string, and finds at each position the first element in [delimiters]
* that matches this string at that position.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.splitToSequence(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): Sequence<String> =
splitToSequence(*delimiters, ignoreCase = ignoreCase, limit = limit)
/**
* Splits this string to a list of strings around occurrences of the specified [delimiters].
*
* @param delimiters One or more strings to be used as delimiters.
* @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.
* @param limit The maximum number of substrings to return. Zero by default means no limit is set.
*
* To avoid ambiguous results when strings in [delimiters] have characters in common, this method proceeds from
* the beginning to the end of this string, and matches at each position the first element in [delimiters]
* that is equal to a delimiter in this instance at that position.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.split(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List<String> =
splitToSequence(*delimiters, ignoreCase = ignoreCase, limit = limit).toList()
/**
* Splits this string to a sequence of strings around occurrences of the specified [delimiters].
*
* @param delimiters One or more characters to be used as delimiters.
* @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.
* @param limit The maximum number of substrings to return.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.splitToSequence(vararg delimiters: Char, ignoreCase: Boolean = false, limit: Int = 0): Sequence<String> =
splitToSequence(*delimiters, ignoreCase = ignoreCase, limit = limit)
/**
* Splits this string to a list of strings around occurrences of the specified [delimiters].
*
* @param delimiters One or more characters to be used as delimiters.
* @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.
* @param limit The maximum number of substrings to return.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.split(vararg delimiters: Char, ignoreCase: Boolean = false, limit: Int = 0): List<String> =
splitToSequence(*delimiters, ignoreCase = ignoreCase, limit = limit).toList()
/**
* Splits this string around matches of the given regular expression.
*
* @param limit Non-negative value specifying the maximum number of substrings to return.
* Zero by default means no limit is set.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.split(pattern: Regex, limit: Int = 0): List<String> = pattern.split(this, limit)
/**
* Splits this string to a sequence of lines delimited by any of the following character sequences: CRLF, LF or CR.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.lineSequence(): Sequence<String> = lineSequence()
/**
* * Splits this string to a list of lines delimited by any of the following character sequences: CRLF, LF or CR.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.lines(): List<String> = lineSequence().toList()
@@ -1,182 +0,0 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
package kotlin.text
import java.io.StringReader
import java.util.regex.Pattern
import java.nio.charset.Charset
import java.util.*
/*
/**
* Returns `true` if this string is equal to [anotherString], optionally ignoring character case.
*
* @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
*/
public fun String.equals(anotherString: String, ignoreCase: Boolean = false): Boolean {
return if (!ignoreCase)
(this as java.lang.String).equals(anotherString)
else
(this as java.lang.String).equalsIgnoreCase(anotherString)
}
/**
* Returns a new string with all occurrences of [oldChar] replaced with [newChar].
*/
public fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String {
if (!ignoreCase)
return (this as java.lang.String).replace(oldChar, newChar)
else
return splitToSequence(oldChar, ignoreCase = ignoreCase).joinToString(separator = newChar.toString())
}
/**
* Returns a new string obtained by replacing all occurrences of the [oldValue] substring in this string
* with the specified [newValue] string.
*/
public fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String =
splitToSequence(oldValue, ignoreCase = ignoreCase).joinToString(separator = newValue)
/**
* Returns a new string with the first occurrence of [oldChar] replaced with [newChar].
*/
public fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String {
val index = indexOf(oldChar, ignoreCase = ignoreCase)
return if (index < 0) this else this.replaceRange(index, index + 1, newChar.toString())
}
/**
* Returns a new string obtained by replacing the first occurrence of the [oldValue] substring in this string
* with the specified [newValue] string.
*/
public fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String {
val index = indexOf(oldValue, ignoreCase = ignoreCase)
return if (index < 0) this else this.replaceRange(index, index + oldValue.length(), newValue)
}
*/
/**
* Splits this string around matches of the given regular expression.
* @param limit Non-negative value specifying the maximum number of substrings to return.
* Zero by default means no limit is set.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.split(regex: Pattern, limit: Int = 0): List<String>
{
require(limit >= 0, { "Limit must be non-negative, but was $limit" } )
return regex.split(this, if (limit == 0) -1 else limit).asList()
}
/*
/**
* Compares two strings lexicographically, optionally ignoring case differences.
*/
public fun String.compareTo(other: String, ignoreCase: Boolean = false): Int {
if (ignoreCase)
return (this as java.lang.String).compareToIgnoreCase(other)
else
return (this as java.lang.String).compareTo(other)
}
/**
* Returns a new string obtained by concatenating this string and the specified string.
*/
public fun String.concat(str: String): String = (this as java.lang.String).concat(str)
/**
* Returns `true` if this string is equal to the contents of the specified CharSequence.
*/
public fun String.contentEquals(cs: CharSequence): Boolean = (this as java.lang.String).contentEquals(cs)
/**
* Returns `true` if this string is equal to the contents of the specified StringBuffer.
*/
public fun String.contentEquals(sb: StringBuffer): Boolean = (this as java.lang.String).contentEquals(sb)
*/
/**
* Returns `true` if this string is empty or consists solely of whitespace characters.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.isBlank(): Boolean = length() == 0 || all { it.isWhitespace() }
/*
/**
* Returns a subsequence of this sequence specified by given [range].
*/
public fun CharSequence.slice(range: IntRange): CharSequence {
return subSequence(range.start, range.end + 1) // inclusive
}
/**
* Returns a copy of this string having its first letter uppercased, or the original string,
* if it's empty or already starts with an upper case letter.
*
* @sample test.text.StringTest.capitalize
*/
public fun String.capitalize(): String {
return if (isNotEmpty() && charAt(0).isLowerCase()) substring(0, 1).toUpperCase() + substring(1) else this
}
/**
* Returns a copy of this string having its first letter lowercased, or the original string,
* if it's empty or already starts with a lower case letter.
*
* @sample test.text.StringTest.decapitalize
*/
public fun String.decapitalize(): String {
return if (isNotEmpty() && charAt(0).isUpperCase()) substring(0, 1).toLowerCase() + substring(1) else this
}
*/
/**
* Repeats a given string [n] times.
* @throws [IllegalArgumentException] when n < 0.
* @sample test.text.StringJVMTest.repeat
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.repeat(n: Int): String {
if (n < 0)
throw IllegalArgumentException("Value should be non-negative, but was $n")
val sb = StringBuilder()
for (i in 1..n) {
sb.append(this)
}
return sb.toString()
}
/**
* Appends the contents of this string, excluding the first characters that satisfy the given [predicate],
* to the given Appendable.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <T : Appendable> String.dropWhileTo(result: T, predicate: (Char) -> Boolean): T {
var start = true
for (element in this) {
if (start && predicate(element)) {
// ignore
} else {
start = false
result.append(element)
}
}
return result
}
/**
* Appends the first characters from this string that satisfy the given [predicate] to the given Appendable.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <T : Appendable> String.takeWhileTo(result: T, predicate: (Char) -> Boolean): T {
for (c in this) if (predicate(c)) result.append(c) else break
return result
}
@@ -27,13 +27,6 @@ import kotlin.reflect.KClass
@Deprecated("Use 'kotlin.jvm.Throws' instead", ReplaceWith("kotlin.jvm.Throws"), DeprecationLevel.ERROR)
public annotation class throws(public vararg val exceptionClasses: KClass<out Throwable>)
/**
* Returns the runtime Java class of this object.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public val <T: Any> T.javaClass : Class<T>
get() = (this as java.lang.Object).getClass() as Class<T>
/**
* Returns the Java class for the specified type.
*/