From 22a858df2cb239c169c3fd129a8d0eb840e595a3 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 15 Mar 2019 03:53:21 +0300 Subject: [PATCH] Clarify behavior of MutableSet.add (KT-29373) --- .../main/kotlin/kotlin/collections/AbstractMutableSet.kt | 2 +- runtime/src/main/kotlin/kotlin/collections/Set.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/runtime/src/main/kotlin/kotlin/collections/AbstractMutableSet.kt b/runtime/src/main/kotlin/kotlin/collections/AbstractMutableSet.kt index fedb8e5f55d..986ed7134ae 100644 --- a/runtime/src/main/kotlin/kotlin/collections/AbstractMutableSet.kt +++ b/runtime/src/main/kotlin/kotlin/collections/AbstractMutableSet.kt @@ -17,7 +17,7 @@ public actual abstract class AbstractMutableSet protected actual constructor( /** * Compares this set with another set instance with the unordered structural equality. * - * @return true, if [other] instance is a [Set] of the same size, all elements of which are contained in this set. + * @return `true`, if [other] instance is a [Set] of the same size, all elements of which are contained in this set. */ override fun equals(other: Any?): Boolean { if (other === this) return true diff --git a/runtime/src/main/kotlin/kotlin/collections/Set.kt b/runtime/src/main/kotlin/kotlin/collections/Set.kt index f396dfb7800..68ca7ba850c 100644 --- a/runtime/src/main/kotlin/kotlin/collections/Set.kt +++ b/runtime/src/main/kotlin/kotlin/collections/Set.kt @@ -33,6 +33,12 @@ public interface MutableSet : Set, MutableCollection { override fun iterator(): MutableIterator // Modification Operations + + /** + * Adds the specified element to the set. + * + * @return `true` if the element has been added, `false` if the element is already contained in the set. + */ override fun add(element: E): Boolean override fun remove(element: E): Boolean