Kotlin HashSet minusElement()
Syntax & Examples


Syntax of HashSet.minusElement()

There are 2 variations for the syntax of HashSet.minusElement() extension function. They are:

1.
fun <T> Iterable<T>.minusElement(element: T): List<T>

This extension function returns a list containing all elements of the original collection without the first occurrence of the given element.

2.
fun <T> Set<T>.minusElement(element: T): Set<T>

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