Adjust stdlib to isEmpty transformation
This commit is contained in:
@@ -10175,7 +10175,7 @@ public fun <T> Array<out T>.asList(): List<T> {
|
||||
public fun BooleanArray.asList(): List<Boolean> {
|
||||
return object : AbstractList<Boolean>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Boolean): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Boolean> = this@asList.iterator() as MutableIterator<Boolean>
|
||||
override fun get(index: Int): Boolean = this@asList[index]
|
||||
@@ -10191,7 +10191,7 @@ public fun BooleanArray.asList(): List<Boolean> {
|
||||
public fun ByteArray.asList(): List<Byte> {
|
||||
return object : AbstractList<Byte>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Byte): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Byte> = this@asList.iterator() as MutableIterator<Byte>
|
||||
override fun get(index: Int): Byte = this@asList[index]
|
||||
@@ -10207,7 +10207,7 @@ public fun ByteArray.asList(): List<Byte> {
|
||||
public fun CharArray.asList(): List<Char> {
|
||||
return object : AbstractList<Char>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Char): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Char> = this@asList.iterator() as MutableIterator<Char>
|
||||
override fun get(index: Int): Char = this@asList[index]
|
||||
@@ -10223,7 +10223,7 @@ public fun CharArray.asList(): List<Char> {
|
||||
public fun DoubleArray.asList(): List<Double> {
|
||||
return object : AbstractList<Double>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Double): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Double> = this@asList.iterator() as MutableIterator<Double>
|
||||
override fun get(index: Int): Double = this@asList[index]
|
||||
@@ -10239,7 +10239,7 @@ public fun DoubleArray.asList(): List<Double> {
|
||||
public fun FloatArray.asList(): List<Float> {
|
||||
return object : AbstractList<Float>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Float): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Float> = this@asList.iterator() as MutableIterator<Float>
|
||||
override fun get(index: Int): Float = this@asList[index]
|
||||
@@ -10255,7 +10255,7 @@ public fun FloatArray.asList(): List<Float> {
|
||||
public fun IntArray.asList(): List<Int> {
|
||||
return object : AbstractList<Int>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Int): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Int> = this@asList.iterator() as MutableIterator<Int>
|
||||
override fun get(index: Int): Int = this@asList[index]
|
||||
@@ -10271,7 +10271,7 @@ public fun IntArray.asList(): List<Int> {
|
||||
public fun LongArray.asList(): List<Long> {
|
||||
return object : AbstractList<Long>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Long): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Long> = this@asList.iterator() as MutableIterator<Long>
|
||||
override fun get(index: Int): Long = this@asList[index]
|
||||
@@ -10287,7 +10287,7 @@ public fun LongArray.asList(): List<Long> {
|
||||
public fun ShortArray.asList(): List<Short> {
|
||||
return object : AbstractList<Short>(), RandomAccess {
|
||||
override val size: Int get() = this@asList.size()
|
||||
override fun isEmpty(): Boolean = this@asList.isEmpty()
|
||||
override val isEmpty: Boolean get() = this@asList.isEmpty()
|
||||
override fun contains(o: Short): Boolean = this@asList.contains(o)
|
||||
override fun iterator(): MutableIterator<Short> = this@asList.iterator() as MutableIterator<Short>
|
||||
override fun get(index: Int): Short = this@asList[index]
|
||||
|
||||
@@ -21,7 +21,7 @@ internal object EmptyList : List<Nothing>, Serializable {
|
||||
override fun toString(): String = "[]"
|
||||
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override val isEmpty: Boolean get() = true
|
||||
override fun contains(o: Nothing): Boolean = false
|
||||
override fun containsAll(c: Collection<Nothing>): Boolean = c.isEmpty()
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ private class MapWithDefaultImpl<K, out V>(public override val map: Map<K,V>, pr
|
||||
override fun hashCode(): Int = map.hashCode()
|
||||
override fun toString(): String = map.toString()
|
||||
override val size: Int get() = map.size()
|
||||
override fun isEmpty(): Boolean = map.isEmpty()
|
||||
override val isEmpty: Boolean get() = map.isEmpty()
|
||||
override fun containsKey(key: Any?): Boolean = map.containsKey(key)
|
||||
override fun containsValue(value: Any?): Boolean = map.containsValue(value)
|
||||
override fun get(key: Any?): V? = map.get(key)
|
||||
@@ -81,7 +81,7 @@ private class MutableMapWithDefaultImpl<K, V>(public override val map: MutableMa
|
||||
override fun hashCode(): Int = map.hashCode()
|
||||
override fun toString(): String = map.toString()
|
||||
override val size: Int get() = map.size()
|
||||
override fun isEmpty(): Boolean = map.isEmpty()
|
||||
override val isEmpty: Boolean get() = map.isEmpty()
|
||||
override fun containsKey(key: Any?): Boolean = map.containsKey(key)
|
||||
override fun containsValue(value: Any?): Boolean = map.containsValue(value)
|
||||
override fun get(key: Any?): V? = map.get(key)
|
||||
|
||||
@@ -12,7 +12,7 @@ private object EmptyMap : Map<Any, Nothing>, Serializable {
|
||||
override fun toString(): String = "{}"
|
||||
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override val isEmpty: Boolean get() = true
|
||||
|
||||
override fun containsKey(key: Any?): Boolean = false
|
||||
override fun containsValue(value: Any?): Boolean = false
|
||||
@@ -103,18 +103,6 @@ public fun <K,V> Map<K,V>?.orEmpty() : Map<K,V> = this ?: emptyMap()
|
||||
*/
|
||||
public operator fun <K,V> Map<K,V>.contains(key : K) : Boolean = containsKey(key)
|
||||
|
||||
/**
|
||||
* Allows to access the key of a map entry as a property. Equivalent to `getKey()`.
|
||||
*/
|
||||
public val <K, V> Map.Entry<K, V>.key: K
|
||||
get() = getKey()
|
||||
|
||||
/**
|
||||
* Allows to access the value of a map entry as a property. Equivalent to `getValue()`.
|
||||
*/
|
||||
public val <K, V> Map.Entry<K, V>.value: V
|
||||
get() = getValue()
|
||||
|
||||
/**
|
||||
* Returns the key component of the map entry.
|
||||
*
|
||||
|
||||
@@ -5,9 +5,23 @@ package kotlin
|
||||
|
||||
@Deprecated("Use property `size` instead", ReplaceWith("this.size"))
|
||||
public inline fun Collection<*>.size() = size
|
||||
|
||||
@Deprecated("Use property `size` instead", ReplaceWith("this.size"))
|
||||
public inline fun Map<*, *>.size() = size
|
||||
|
||||
@Deprecated("Use property `isEmpty` instead", ReplaceWith("this.isEmpty"))
|
||||
public inline fun Collection<*>.isEmpty() = isEmpty
|
||||
|
||||
@Deprecated("Use property `isEmpty` instead", ReplaceWith("this.isEmpty"))
|
||||
public inline fun Map<*, *>.isEmpty() = isEmpty
|
||||
|
||||
|
||||
@Deprecated("Use property `key` instead", ReplaceWith("this.key"))
|
||||
public fun <K, V> Map.Entry<K, V>.getKey(): K = key
|
||||
|
||||
@Deprecated("Use property `value` instead", ReplaceWith("this.value"))
|
||||
public fun <K, V> Map.Entry<K, V>.getValue(): V = value
|
||||
|
||||
/**
|
||||
* Adds the specified [element] to this mutable collection.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ internal object EmptySet : Set<Nothing>, Serializable {
|
||||
override fun toString(): String = "[]"
|
||||
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override val isEmpty: Boolean get() = true
|
||||
override fun contains(o: Nothing): Boolean = false
|
||||
override fun containsAll(c: Collection<Nothing>): Boolean = c.isEmpty()
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ private class MatcherMatchResult(private val matcher: Matcher, private val input
|
||||
|
||||
override val groups: MatchGroupCollection = object : MatchGroupCollection {
|
||||
override val size: Int get() = matchResult.groupCount() + 1
|
||||
override fun isEmpty(): Boolean = false
|
||||
override val isEmpty: Boolean get() = false
|
||||
override fun contains(o: MatchGroup?): Boolean = this.any({ it == o })
|
||||
override fun containsAll(c: Collection<MatchGroup?>): Boolean = c.all({contains(it)})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user