Reword contract of Collection's removeAll and retainAll to emphasize that the criteria to remove or retain element is the containment in the specified collection.

Collection.remove(element): clarify docs.
This commit is contained in:
Ilya Gorbunov
2015-07-10 17:14:22 +03:00
parent 2c28c5a8e8
commit ecba29a08a
+4 -3
View File
@@ -86,7 +86,8 @@ public interface MutableCollection<E> : Collection<E>, MutableIterable<E> {
public fun add(e: E): Boolean public fun add(e: E): Boolean
/** /**
* Removes the specified element from the collection. * Removes a single instance of the specified element from this
* collection, if it is present.
* *
* @return `true` if the element has been successfully removed; `false` if it was not present in the collection. * @return `true` if the element has been successfully removed; `false` if it was not present in the collection.
*/ */
@@ -101,14 +102,14 @@ public interface MutableCollection<E> : Collection<E>, MutableIterable<E> {
public fun addAll(c: Collection<E>): Boolean public fun addAll(c: Collection<E>): Boolean
/** /**
* Removes all of the elements in the specified collection from this collection. * Removes all of this collection's elements that are also contained in the specified collection.
* *
* @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified. * @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified.
*/ */
public fun removeAll(c: Collection<Any?>): Boolean public fun removeAll(c: Collection<Any?>): Boolean
/** /**
* Removes all of the elements not contained in the specified collection from this collection. * Retains only the elements in this collection that are contained in the specified collection.
* *
* @return `true` if any element was removed from the collection, `false` if the collection was not modified. * @return `true` if any element was removed from the collection, `false` if the collection was not modified.
*/ */