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
class Option[A]
object None.type
class Some[A]
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 OpenHashMap[Key, Value]
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.type
class NumericRange[T]
class Exclusive[T]
class Inclusive[T]
class Queue[A]
class Range
class Exclusive
class Inclusive
class Stream[A]
class Cons[A]
object Empty.type
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 LinkedHashSet[A]
class TreeSet[A]
class AbstractView[A]
class AbstractMapView[K, V]
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.type
class Fill[A]
class Filter[A]
class FlatMap[A, B]
class Iterate[A]
class LeftPartitionMapped[A, A1, A2]
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 RightPartitionMapped[A, A1, A2]
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]
class ZipWithIndex[A]
class PriorityQueue[A]
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 IndexedBuffer[A]
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]
trait MapFactoryDefaults[K, V, CC, WithFilterCC]
class WeakHashMap[K, V]
trait MapOps[K, V, CC, C]
trait SortedMapFactoryDefaults[K, V, CC, WithFilterCC, UnsortedCC]
trait SortedMapOps[K, V, CC, C]
trait StrictOptimizedSortedMapOps[K, V, CC, C]
trait StrictOptimizedSortedMapOps[K, V, CC, C]
trait SortedMapOps[K, V, CC, C]
trait SortedMapOps[K, V, CC, C]
trait StrictOptimizedMapOps[K, V, CC, C]
trait StrictOptimizedMapOps[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 StrictOptimizedSeqOps[A, CC, C]
trait StrictOptimizedSeqOps[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 SortedSetFactoryDefaults[A, CC, WithFilterCC]
trait SortedSetOps[A, CC, C]
trait SortedSetOps[A, CC, C]
trait StrictOptimizedSetOps[A, CC, C]
trait StrictOptimizedSetOps[A, CC, C]
trait SetOps[A, CC, C]
trait SetOps[A, CC, C]
trait Iterator[A]
class Source

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

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