This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Why does Builder redefine method inherited from Growable

No replies
Stefan Wachter
Joined: 2009-09-18,
User offline. Last seen 42 years 45 weeks ago.

Hi all,

sorry if this is a stupid question. I try to get a deeper understanding
of Scala by having a look on the new collection classes of version 2.8.

In the trait scala.collection.generic.Builder if found these two defintions:

/** Adds a single element to the builder.
* @param elem The element to be added
*/
def +=(elem: Elem): this.type

/** Clear the contents of this builder
*/
def clear()

The Builder trait extends the Growable trait that contains the same
defintions:

/** Adds a single element to this collection.
*
* @param elem the element to add.
*/
def +=(elem: A): this.type

/** Clears the collection contents.
*/
def clear()

Why are these methods redefined on the Builder trait?

Thanks for your attention,

Stefan

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland