0

2.13.3 API says:

def addOne(elem: A): ArrayBuffer.this.type

Adds a single element to this array buffer.

final def append(elem: A): ArrayBuffer.this.type

Appends the given elements to this buffer.

They seem to do the exact same thing?

1 Answers1

3

They are the same thing. ArrayBuffer is a descendent of Buffer, which defines append:

@`inline` final def append(elem: A): this.type = addOne(elem)

addOne is implemented in ArrayBuffer as part of its implementation towards Growable.

See: Buffer.scala.

Michael Zajac
  • 55,144
  • 7
  • 113
  • 138