Buffer is a mutable data structure with two operations:
- append an element
- convert the buffer to an array or arrays.
- Internally it is stored as a growable sequence of arrays. It never recopies data internally during an append, but it may allocate during append.
- It is specialized for primitive types.
- It can store more elements than Int.MaxValue, however in this case toArray will throw (use toArrays).
val b = org.saddle.Buffer.empty[Int]
// b: org.saddle.Buffer[Int] = org.saddle.Buffer@2fccb1c5
b += 3
// res0: org.saddle.Buffer[Int] = org.saddle.Buffer@2fccb1c5
b.toArray
// res1: Array[Int] = Array(3)