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

Misleading Javadocs?

1 reply
Ian Clarke
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Consider the function ":+" in scala.collection.mutable.LinkedList.
The documentation says "Appends an element to this linked list"
However in actuality it doesn't modify the LinkedList, rather it returns a new LinkedList with the element appended to it.
Isn't this misleading, or outright incorrect?
Ian.
odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: Misleading Javadocs?
Hi Ian, I agree it's misleading. I'll change the summary. Note that the full docs already imply that a new collection is returned:
returns

a new collection of type That consisting of elem followed by all elements of this linked list.

Cheers

 -- Martin

On Sun, May 22, 2011 at 1:04 PM, Ian Clarke <ian.clarke@gmail.com> wrote:
Consider the function ":+" in scala.collection.mutable.LinkedList.
The documentation says "Appends an element to this linked list"
However in actuality it doesn't modify the LinkedList, rather it returns a new LinkedList with the element appended to it.
Isn't this misleading, or outright incorrect?
Ian.



--
----------------------------------------------
Martin Odersky
Prof., EPFL and CEO, 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