NArrayBuilder

narr.NArrayBuilder
See theNArrayBuilder companion object
trait NArrayBuilder[T]

Design notes:

  • If you already know the size of the result, you wouldn't use a builder at all.
  • Minimize memory footprint and copy operations.
  • som-snytt
    • That's an interesting experiment worth benchmarking. Personally I'd optimize for new Builder().addAll(xs).result but it depends.
    • I like the idea of keeping the "strategy" in a var instead of a confusing if/else.
    • Alternatively, switch on the current state

Type parameters

T

type of the Array elements.

Attributes

Companion
object
Source
NArrayBuilder.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def addAll(es: Array[T]): this.type

Attributes

Source
NArrayBuilder.scala
def addOne(e: T): this.type

Attributes

Source
NArrayBuilder.scala
def apply(idx: Int): T

Attributes

Source
NArrayBuilder.scala
def copyInto(src: Array[T], dest: Array[T], dstPos: Int): Unit

Attributes

Source
NArrayBuilder.scala
def copyInto(src: Array[T], srcPos: Int, dest: Array[T], dstPos: Int, length: Int): Unit

Attributes

Source
NArrayBuilder.scala
def makeNArray(len: Int): Array[T]

Attributes

Source
NArrayBuilder.scala
def result: Array[T]

Attributes

Source
NArrayBuilder.scala
def size: Int

Attributes

Source
NArrayBuilder.scala

Concrete methods

inline def ++=(xs: Array[T]): this.type

Attributes

Source
NArrayBuilder.scala
inline def ++=(itr: Iterator[T]): this.type

Attributes

Source
NArrayBuilder.scala
inline def ++=(xs: IterableOnce[T]): this.type

Attributes

Source
NArrayBuilder.scala
inline def +=(e: T): this.type

Attributes

Source
NArrayBuilder.scala
def addAll(xs: Array[T], offset: Int, length: Int): this.type

Add a slice of an array.

Add a slice of an array.

Attributes

Source
NArrayBuilder.scala
def addAll(itr: Iterator[T]): this.type

Attributes

Source
NArrayBuilder.scala
def addAll(xs: IterableOnce[T]): this.type

Attributes

Source
NArrayBuilder.scala