← Docs
kotlin-stdlib / kotlin.sequences / constrainOnce

constrainOnce

Common
JVM
JS
Native
1.0
fun < T > Sequence < T > . constrainOnce ( ) : Sequence < T >
(source)

Returns a wrapper sequence that provides values of this sequence, but ensures it can be iterated only one time.

The operation is intermediate and stateless .

IllegalStateException is thrown on iterating the returned sequence for the second time and the following times.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .