Kotlin Set minus()
Syntax & Examples


Syntax of Set.minus()

There are 4 variations for the syntax of Set.minus() extension function. They are:

1.
operator fun <T> Set<T>.minus(element: T): Set<T>

This extension function returns a set containing all elements of the original set except the given element.

2.
operator fun <T> Set<T>.minus(elements: Array<out T>): Set<T>

This extension function returns a set containing all elements of the original set except the elements contained in the given elements array.

3.
operator fun <T> Set<T>.minus(elements: Iterable<T>): Set<T>

This extension function returns a set containing all elements of the original set except the elements contained in the given elements collection.

4.
operator fun <T> Set<T>.minus(elements: Sequence<T>): Set<T>

This extension function returns a set containing all elements of the original set except the elements contained in the given elements sequence.