Kotlin HashSet plusElement()
Syntax & Examples
Syntax of HashSet.plusElement()
There are 2 variations for the syntax of HashSet.plusElement() extension function. They are:
1.
fun <T> Iterable<T>.plusElement(element: T): List<T>
This extension function returns a list containing all elements of the original collection and then the given element.
2.
fun <T> Set<T>.plusElement(element: T): Set<T>
This extension function returns a set containing all elements of the original set and then the given element if it isn't already in this set.