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

Default implementation for Seq() - documentation or implementation bug?

1 reply
etorreborre 2
Joined: 2011-02-23,
User offline. Last seen 42 years 45 weeks ago.
Hi,
I just saw that the documentation for scala.collection.Seq says that the default implementation for Seq() was Vector:
/** $factoryInfo *  The current default implementation of a $Coll is a `Vector`. *  @define coll sequence *  @define Coll Seq */object Seq extends SeqFactory[Seq] {
However, the implementation for immutable.Seq.newBuilder[A] is:
def newBuilder[A]: Builder[A, Seq[A]] = new mutable.ListBuffer

Is this a bug in the doc or in the code (I was expecting that Seq() was Vector based as the doc says)?
Eric.



odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: Default implementation for Seq() - documentation or impleme
It's a bug in the doc. Thanks for pointing it out!
 -- Martin

On Mon, Oct 24, 2011 at 1:25 AM, etorreborre <etorreborre [at] gmail [dot] com> wrote:
Hi,
I just saw that the documentation for scala.collection.Seq says that the default implementation for Seq() was Vector:
/** $factoryInfo *  The current default implementation of a $Coll is a `Vector`. *  @define coll sequence *  @define Coll Seq */object Seq extends SeqFactory[Seq] {
However, the implementation for immutable.Seq.newBuilder[A] is:
def newBuilder[A]: Builder[A, Seq[A]] = new mutable.ListBuffer

Is this a bug in the doc or in the code (I was expecting that Seq() was Vector based as the doc says)?
Eric.






--
Martin Odersky
Prof., EPFL and Chairman, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967

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