I am using a mutable Buffer
and need to find out how many elements it has.
Both size
and length
methods are defined, inherited
They are synonyms, mostly a result of Java's decision of having size
for collections and length
for Array
and String
. One will always be defined in terms of the other, and you can easily see which is which by looking at the source code, the link for which is provided on scaladoc. Just find the defining trait, open the source code, and search for def size
or def length
.