Correct abstract mutable collections declarations in kotlin-stdlib-common

Add SinceKotlin(1.3) to the new and substantially changed common declarations

#KT-28091
This commit is contained in:
Ilya Gorbunov
2018-11-02 00:06:37 +03:00
parent 4f2ec3533a
commit 5f4e8bf4fb
8 changed files with 263 additions and 19 deletions
@@ -0,0 +1,32 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
/**
* Provides a skeletal implementation of the [MutableCollection] interface.
*
* @param E the type of elements contained in the collection. The collection is invariant on its element type.
*/
@SinceKotlin("1.3")
public expect abstract class AbstractMutableCollection<E> : MutableCollection<E> {
protected constructor()
abstract override val size: Int
abstract override fun iterator(): MutableIterator<E>
abstract override fun add(element: E): Boolean
override fun isEmpty(): Boolean
override fun contains(element: @UnsafeVariance E): Boolean
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
override fun addAll(elements: Collection<E>): Boolean
override fun remove(element: E): Boolean
override fun removeAll(elements: Collection<E>): Boolean
override fun retainAll(elements: Collection<E>): Boolean
override fun clear(): Unit
}
@@ -5,7 +5,12 @@
package kotlin.collections
expect abstract class AbstractMutableList<E> : MutableList<E> {
/**
* Provides a skeletal implementation of the [MutableList] interface.
*
* @param E the type of elements contained in the list. The list is invariant on its element type.
*/
public expect abstract class AbstractMutableList<E> : MutableList<E> {
protected constructor()
// From List
@@ -5,8 +5,16 @@
package kotlin.collections
expect abstract class AbstractMutableMap<K, V> : MutableMap<K, V> {
/**
* Provides a skeletal implementation of the [MutableMap] interface.
*
* The implementor is required to implement [entries] property, which should return mutable set of map entries, and [put] function.
*
* @param K the type of map keys. The map is invariant on its key type.
* @param V the type of map values. The map is invariant on its value type.
*/
@SinceKotlin("1.3")
public expect abstract class AbstractMutableMap<K, V> : MutableMap<K, V> {
protected constructor()
/**
@@ -18,4 +26,17 @@ expect abstract class AbstractMutableMap<K, V> : MutableMap<K, V> {
* @return the previous value associated with the key, or `null` if the key was not present in the map.
*/
abstract override fun put(key: K, value: V): V?
abstract override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
override val keys: MutableSet<K>
override val size: Int
override val values: MutableCollection<V>
override fun clear()
override fun containsKey(key: K): Boolean
override fun containsValue(value: V): Boolean
override fun get(key: K): V?
override fun isEmpty(): Boolean
override fun putAll(from: Map<out K, V>)
override fun remove(key: K): V?
}
@@ -5,8 +5,27 @@
package kotlin.collections
expect abstract class AbstractMutableSet<E> : MutableSet<E> {
/**
* Provides a skeletal implementation of the [MutableSet] interface.
*
* @param E the type of elements contained in the set. The set is invariant on its element type.
*/
@SinceKotlin("1.3")
public expect abstract class AbstractMutableSet<E> : MutableSet<E> {
protected constructor()
abstract override val size: Int
abstract override fun iterator(): MutableIterator<E>
abstract override fun add(element: E): Boolean
override fun isEmpty(): Boolean
override fun contains(element: @UnsafeVariance E): Boolean
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
override fun addAll(elements: Collection<E>): Boolean
override fun remove(element: E): Boolean
override fun removeAll(elements: Collection<E>): Boolean
override fun retainAll(elements: Collection<E>): Boolean
override fun clear(): Unit
}