diff options
author | michelou <michelou@epfl.ch> | 2008-02-26 17:50:12 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-02-26 17:50:12 +0000 |
commit | 6b1bf0c0c9579c7dda0169bc5fb8a1322407d7a7 (patch) | |
tree | eaecd2496d5f9b30c85760b8a0cb9267a1e972a9 /src/library/scala/collection/mutable/LinkedList.scala | |
parent | e2d790348afa914fba28bc71775b818ef71ed1f5 (diff) | |
download | scala-6b1bf0c0c9579c7dda0169bc5fb8a1322407d7a7.tar.gz scala-6b1bf0c0c9579c7dda0169bc5fb8a1322407d7a7.tar.bz2 scala-6b1bf0c0c9579c7dda0169bc5fb8a1322407d7a7.zip |
fixed #551 and #566
Diffstat (limited to 'src/library/scala/collection/mutable/LinkedList.scala')
-rw-r--r-- | src/library/scala/collection/mutable/LinkedList.scala | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/library/scala/collection/mutable/LinkedList.scala b/src/library/scala/collection/mutable/LinkedList.scala index 0ed1a02889..6b9cef7234 100644 --- a/src/library/scala/collection/mutable/LinkedList.scala +++ b/src/library/scala/collection/mutable/LinkedList.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** @@ -22,11 +22,24 @@ class LinkedList[A](var elem: A, var next: LinkedList[A]) extends SingleLinkedList[A, LinkedList[A]] { + /** Compares two lists structurally; i.e. checks if all elements + * contained in this list are also contained in the other list, + * and vice versa. + * + * @param that the other list + * @return <code>true</code> iff both lists contain exactly the + * same mappings. + */ override def equals(obj: Any): Boolean = obj match { case that: LinkedList[_] => this.toList equals that.toList case _ => false } + /** A hash method compatible with <code>equals</code> + */ + override def hashCode(): Int = + (0 /: elements) ((hash, kv) => hash + kv.hashCode) + override protected def stringPrefix: String = "LinkedList" } |