IterableOnce

trait IterableOnce[+A]

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
Source
IterableOnce.scala
class Any
trait Iterable[A]
class AbstractMap[K, V]
class AbstractMap[K, V]
class HashMap[K, V]
class IntMap[T]
class ListMap[K, V]
class LongMap[T]
class Map1[K, V]
class Map2[K, V]
class Map3[K, V]
class Map4[K, V]
class WithDefault[K, V]
class WithDefault[K, V]
class TreeMap[K, V]
class TreeSeqMap[K, V]
class VectorMap[K, V]
class AbstractMap[K, V]
class TrieMap[K, V]
class AnyRefMap[K, V]
class HashMap[K, V]
class LinkedHashMap[K, V]
class ListMap[K, V]
class LongMap[V]
class WithDefault[K, V]
class WithDefault[K, V]
class TreeMap[K, V]
class AbstractSeq[A]
class AbstractSeq[A]
class ArraySeq[A]
class ofBoolean
class ofByte
class ofChar
class ofDouble
class ofFloat
class ofInt
class ofLong
class ofRef[T]
class ofShort
class ofUnit
class LazyList[A]
class List[A]
class ::[A]
object Nil
class Exclusive[T]
class Inclusive[T]
class Queue[A]
class Range
class Exclusive
class Inclusive
class Stream[A]
class Cons[A]
object Empty
class Vector[A]
class AbstractSeq[A]
class ArrayBuffer[A]
class ArrayDeque[A]
class Queue[A]
class Stack[A]
class ListBuffer[A]
class ArraySeq[T]
class ofBoolean
class ofByte
class ofChar
class ofDouble
class ofFloat
class ofInt
class ofLong
class ofRef[T]
class ofShort
class ofUnit
class AbstractSet[A]
class AbstractSet[A]
class ValueSet
class BitSet
class BitSet1
class BitSet2
class BitSetN
class HashSet[A]
class ListSet[A]
class Set1[A]
class Set2[A]
class Set3[A]
class Set4[A]
class TreeSet[A]
class AbstractSet[A]
class BitSet
class HashSet[A]
class TreeSet[A]
class Filter[K, V]
class FilterKeys[K, V]
class Id[K, V]
class MapValues[K, V, W]
class TapEach[K, V, U]
class Slice[A]
class Id[A]
class Id[A]
class Reverse[A]
class Reverse[A]
class Appended[A]
class Appended[A]
class Appended[A]
class Collect[A, B]
class Concat[A]
class Concat[A]
class Concat[A]
class DistinctBy[A, B]
class Drop[A]
class Drop[A]
class Drop[A]
class DropRight[A]
class DropRight[A]
class DropRight[A]
class DropWhile[A]
class Elems[A]
object Empty
class Fill[A]
class Filter[A]
class FlatMap[A, B]
class Iterate[A]
class Map[A, B]
class Map[A, B]
class Map[A, B]
class PadTo[A]
class Prepended[A]
class Prepended[A]
class Prepended[A]
class ScanLeft[A, B]
class Single[A]
class Tabulate[A]
class Take[A]
class Take[A]
class Take[A]
class TakeRight[A]
class TakeRight[A]
class TakeRight[A]
class TakeWhile[A]
class Unfold[A, S]
class Updated[A]
class Zip[A, B]
class ZipAll[A, B]
trait Map[K, V]
trait DefaultMap[K, V]
trait SeqMap[K, V]
trait SeqMap[K, V]
trait SeqMap[K, V]
trait SortedMap[K, V]
trait SortedMap[K, V]
trait SortedMap[K, V]
trait Map[K, V]
trait Map[K, V]
trait Map[K, V]
trait MultiMap[K, V]
trait Seq[A]
trait IndexedSeq[A]
trait IndexedSeq[A]
trait IndexedSeq[T]
trait LinearSeq[A]
trait LinearSeq[A]
trait Seq[A]
trait Seq[A]
trait Buffer[A]
class Accumulator[A, CC, C]
trait Set[A]
trait SortedSet[A]
trait BitSet
trait SortedSet[A]
trait SortedSet[A]
trait Set[A]
trait Set[A]
trait View[A]
trait MapView[K, V]
trait SeqView[A]
class Sorted[A, B]
trait Iterable[A]
trait Iterable[A]
trait IterableOps[A, CC, C]
class WeakHashMap[K, V]
trait MapOps[K, V, CC, C]
trait SortedMapOps[K, V, CC, C]
trait SortedMapOps[K, V, CC, C]
trait SortedMapOps[K, V, CC, C]
trait MapOps[K, V, CC, C]
trait MapOps[K, V, CC, C]
trait SeqOps[A, CC, C]
trait IndexedSeqOps[A, CC, C]
trait IndexedSeqOps[A, CC, C]
trait IndexedSeqOps[A, CC, C]
trait LinearSeqOps[A, CC, C]
trait LinearSeqOps[A, CC, C]
trait ArrayDequeOps[A, CC, C]
trait SeqOps[A, CC, C]
trait SeqOps[A, CC, C]
trait SetOps[A, CC, C]
trait SortedSetOps[A, CC, C]
trait BitSetOps[C]
trait SortedSetOps[A, CC, C]
trait SortedSetOps[A, CC, C]
trait SetOps[A, CC, C]
trait SetOps[A, CC, C]
trait Iterator[A]

Value members

Abstract methods

Iterator can be used only once

Iterator can be used only once

Source
IterableOnce.scala

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.

Source
IterableOnce.scala
def stepper[S <: Stepper[_]](implicit shape: StepperShape[A, S]): S

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.

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.

Source
IterableOnce.scala

Deprecated methods

@deprecated("Use .iterator.foldLeft instead", "2.13.0") @inline
def /:[B](z: B)(op: (B, A) => B): B
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.foldRight instead", "2.13.0") @inline
def :\[B](z: B)(op: (A, B) => B): B
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.collectFirst(...) instead", "2.13.0")
def collectFirst[B](f: PartialFunction[A, B]): Option[B]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.copyToBuffer(...) instead", "2.13.0")
def copyToBuffer(dest: Buffer[A]): Unit
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.count(...) instead", "2.13.0")
def count(f: A => Boolean): Int
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.exists(...) instead", "2.13.0")
def exists(f: A => Boolean): Boolean
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.filter(...) instead", "2.13.0")
def filter(f: A => Boolean): Iterator[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.find instead", "2.13.0")
def find(p: A => Boolean): Option[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.flatMap instead or consider requiring an Iterable", "2.13.0")
def flatMap[B](f: A => IterableOnce[B]): IterableOnce[B]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.fold instead", "2.13.0")
def fold[A1 >: A](z: A1)(op: (A1, A1) => A1): A1
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.foldLeft instead", "2.13.0") @inline
def foldLeft[B](z: B)(op: (B, A) => B): B
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.foldRight instead", "2.13.0") @inline
def foldRight[B](z: B)(op: (A, B) => B): B
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.forall(...) instead", "2.13.0")
def forall(f: A => Boolean): Boolean
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.foreach(...) instead", "2.13.0") @inline
def foreach[U](f: A => U): Unit
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.isEmpty instead", "2.13.0")
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.map instead or consider requiring an Iterable", "2.13.0")
def map[B](f: A => B): IterableOnce[B]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.max instead", "2.13.0")
def max(implicit ord: Ordering[A]): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.maxBy(...) instead", "2.13.0")
def maxBy[B](f: A => B)(implicit cmp: Ordering[B]): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.min instead", "2.13.0")
def min(implicit ord: Ordering[A]): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.minBy(...) instead", "2.13.0")
def minBy[B](f: A => B)(implicit cmp: Ordering[B]): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.mkString instead", "2.13.0")
def mkString(start: String, sep: String, end: String): String
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.mkString instead", "2.13.0")
def mkString(sep: String): String
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.mkString instead", "2.13.0")
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.nonEmpty instead", "2.13.0")
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.product instead", "2.13.0")
def product(implicit num: Numeric[A]): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.reduce(...) instead", "2.13.0")
def reduce(f: (A, A) => A): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.reduceLeft(...) instead", "2.13.0")
def reduceLeft(f: (A, A) => A): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.reduceLeftOption(...) instead", "2.13.0")
def reduceLeftOption(f: (A, A) => A): Option[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.reduceOption(...) instead", "2.13.0")
def reduceOption(f: (A, A) => A): Option[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.reduceRight(...) instead", "2.13.0")
def reduceRight(f: (A, A) => A): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.reduceRightOption(...) instead", "2.13.0")
def reduceRightOption(f: (A, A) => A): Option[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.sameElements instead", "2.13.0")
def sameElements[B >: A](that: IterableOnce[B]): Boolean
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.size instead", "2.13.0")
def size: Int
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.sum instead", "2.13.0")
def sum(implicit num: Numeric[A]): A
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(factory) instead", "2.13.0")
def to[C1](factory: Factory[A, C1]): C1
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.toArray", "2.13.0")
def toArray[B >: A : ClassTag]: Array[B]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(ArrayBuffer) instead", "2.13.0")
def toBuffer[B >: A]: Buffer[B]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.toIndexedSeq instead", "2.13.0")
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(Iterable) instead", "2.13.0") @inline
final def toIterable: Iterable[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator instead", "2.13.0") @inline
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(List) instead", "2.13.0")
def toList: List[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(Map) instead", "2.13.0")
def toMap[K, V](implicit ev: A <:< (K, V)): Map[K, V]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(Seq) instead", "2.13.0") @inline
def toSeq: Seq[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(Set) instead", "2.13.0") @inline
def toSet[B >: A]: Set[B]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(LazyList) instead", "2.13.0") @inline
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(Iterable) instead", "2.13.0") @inline
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.to(Vector) instead", "2.13.0") @inline
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala
@deprecated("Use .iterator.withFilter(...) instead", "2.13.0")
def withFilter(f: A => Boolean): Iterator[A]
Implicitly added by iterableOnceExtensionMethods
Deprecated
Source
IterableOnce.scala