minus

Common
JVM
JS
Native
1.0
operator fun <T> Sequence<T>.minus(element: T): Sequence<T>
(source)

Returns a sequence containing all elements of the original sequence without the first occurrence of the given element.

The operation is intermediate and stateless.

Common
JVM
JS
Native
1.0
operator fun <T> Sequence<T>.minus(
    elements: Array<out T>
): Sequence<T>

(source)

Returns a sequence containing all elements of original sequence except the elements contained in the given elements array.

Note that the source sequence and the array being subtracted are iterated only when an iterator is requested from the resulting sequence. Changing any of them between successive calls to iterator may affect the result.

Before Kotlin 1.6, the elements array may have been converted to a HashSet to speed up the operation, thus the elements were required to have a correct and stable implementation of hashCode() that didn't change between successive invocations. On JVM, you can enable this behavior back with the system property kotlin.collections.convert_arg_to_set_in_removeAll set to true.

The operation is intermediate and stateful.

Common
JVM
JS
Native
1.0
operator fun <T> Sequence<T>.minus(
    elements: Iterable<T>
): Sequence<T>

(source)

Returns a sequence containing all elements of original sequence except the elements contained in the given elements collection.

Note that the source sequence and the collection being subtracted are iterated only when an iterator is requested from the resulting sequence. Changing any of them between successive calls to iterator may affect the result.

Before Kotlin 1.6, the elements collection may have been converted to a HashSet to speed up the operation, thus the elements were required to have a correct and stable implementation of hashCode() that didn't change between successive invocations. On JVM, you can enable this behavior back with the system property kotlin.collections.convert_arg_to_set_in_removeAll set to true.

The operation is intermediate and stateful.

Common
JVM
JS
Native
1.0
operator fun <T> Sequence<T>.minus(
    elements: Sequence<T>
): Sequence<T>

(source)

Returns a sequence containing all elements of original sequence except the elements contained in the given elements sequence.

Note that the source sequence and the sequence being subtracted are iterated only when an iterator is requested from the resulting sequence. Changing any of them between successive calls to iterator may affect the result.

The operation is intermediate for this sequence and terminal and stateful for the elements sequence.

Before Kotlin 1.6, the elements sequence may have been converted to a HashSet to speed up the operation, thus the elements were required to have a correct and stable implementation of hashCode() that didn't change between successive invocations. On JVM, you can enable this behavior back with the system property kotlin.collections.convert_arg_to_set_in_removeAll set to true.