Kotlin HashSet plus()
Syntax & Examples
Syntax of HashSet.plus()
There are 8 variations for the syntax of HashSet.plus() extension function. They are:
operator fun <T> Iterable<T>.plus(element: T): List<T>
This extension function returns a list containing all elements of the original collection and then the given element.
operator fun <T> Iterable<T>.plus( elements: Array<out T> ): List<T>
This extension function returns a list containing all elements of the original collection and then all elements of the given elements array.
operator fun <T> Iterable<T>.plus( elements: Iterable<T> ): List<T>
This extension function returns a list containing all elements of the original collection and then all elements of the given elements collection.
operator fun <T> Iterable<T>.plus( elements: Sequence<T> ): List<T>
This extension function returns a list containing all elements of the original collection and then all elements of the given elements sequence.
operator fun <T> Set<T>.plus(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.
operator fun <T> Set<T>.plus(elements: Array<out T>): Set<T>
This extension function returns a set containing all elements of the original set and the given elements array, which aren't already in this set.
operator fun <T> Set<T>.plus(elements: Iterable<T>): Set<T>
This extension function returns a set containing all elements of the original set and the given elements collection, which aren't already in this set. The returned set preserves the element iteration order of the original set.
operator fun <T> Set<T>.plus(elements: Sequence<T>): Set<T>
This extension function returns a set containing all elements of the original set and the given elements sequence, which aren't already in this set.