summaryrefslogtreecommitdiff
path: root/sources/scala/collection/mutable/LinkedList.scala
blob: c08928a04a7224b96c3b4688f7c6ae6c498e3003 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003, LAMP/EPFL                  **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
** $Id$
\*                                                                      */

package scala.collection.mutable;

/** This class implements single linked lists where both the head (<code>elem</code>)
 *  and the tail (<code>next</code>) are mutable.
 *
 *  @author  Matthias Zenger
 *  @version 1.0, 08/07/2003
 */
[serializable]
class LinkedList[A](head: A, tail: LinkedList[A])
  extends SingleLinkedList[A, LinkedList[A]]
{
  elem = head;
  next = tail;

  override def equals(obj: Any): Boolean = (
    obj.isInstanceOf[LinkedList[A]]
      && toList.equals((obj.asInstanceOf[LinkedList[A]]).toList)
  );

  override protected def stringPrefix: String = "LinkedList";
}