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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.