A template trait for collections which can be traversed either once only or one or more times.
A template trait for collections which can be traversed either once only or one or more times.
Note: IterableOnce
does not extend IterableOnceOps. This is different than the general
design of the collections library, which uses the following pattern:
trait Seq extends Iterable with SeqOps
trait SeqOps extends IterableOps
trait IndexedSeq extends Seq with IndexedSeqOps
trait IndexedSeqOps extends SeqOps
The goal is to provide a minimal interface without any sequential operations. This allows third-party extension like Scala parallel collections to integrate at the level of IterableOnce without inheriting unwanted implementations.
- Companion
- object
Value members
Abstract methods
Concrete methods
- Returns
The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.
Returns a scala.collection.Stepper for the elements of this collection.
Returns a scala.collection.Stepper for the elements of this collection.
The Stepper enables creating a Java stream to operate on the collection, see scala.jdk.StreamConverters. For collections holding primitive values, the Stepper can be used as an iterator which doesn't box the elements.
The implicit scala.collection.StepperShape parameter defines the resulting Stepper type according to the element type of this collection.
For collections of
Int
,Short
,Byte
orChar
, an scala.collection.IntStepper is returnedFor collections of
Double
orFloat
, a scala.collection.DoubleStepper is returnedFor collections of
Long
a scala.collection.LongStepper is returnedFor any other element type, an scala.collection.AnyStepper is returned
Note that this method is overridden in subclasses and the return type is refined to
S with EfficientSplit
, for example scala.collection.IndexedSeqOps.stepper. For Steppers marked with
scala.collection.Stepper.EfficientSplit, the converters in scala.jdk.StreamConverters
allow creating parallel streams, whereas bare Steppers can be converted only to sequential
streams.
Deprecated methods
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated
- Deprecated