W3cubDocs

/Kotlin

minus

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
operator fun <T> Sequence<T>.minus(element: T): Sequence<T>

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

The operation is intermediate and stateless.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
operator fun <T> Sequence<T>.minus(
    elements: Array<out T>
): Sequence<T>

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.

The elements array may be converted to a HashSet to speed up the operation, thus the elements are required to have a correct and stable implementation of hashCode() that doesn't change between successive invocations.

The operation is intermediate and stateful.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
operator fun <T> Sequence<T>.minus(
    elements: Iterable<T>
): Sequence<T>

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.

The elements collection may be converted to a HashSet to speed up the operation, thus the elements are required to have a correct and stable implementation of hashCode() that doesn't change between successive invocations.

The operation is intermediate and stateful.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
operator fun <T> Sequence<T>.minus(
    elements: Sequence<T>
): Sequence<T>

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.

The elements sequence may be converted to a HashSet to speed up the operation, thus the elements are required to have a correct and stable implementation of hashCode() that doesn't change between successive invocations.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/minus.html