diff options
author | Martin Odersky <odersky@gmail.com> | 2009-11-10 16:31:36 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-11-10 16:31:36 +0000 |
commit | aaa4da9f37a154870e39d7b89239019ce5257337 (patch) | |
tree | 894654170b42b31eb78709ff9a16b1c6b26a7151 /src/library/scala/collection/mutable/LinkedList.scala | |
parent | 928c9eba3bd7b6af7eadb2ef37fcac44b09a3968 (diff) | |
download | scala-aaa4da9f37a154870e39d7b89239019ce5257337.tar.gz scala-aaa4da9f37a154870e39d7b89239019ce5257337.tar.bz2 scala-aaa4da9f37a154870e39d7b89239019ce5257337.zip |
tentative re-implementation of LinkedList and s...
tentative re-implementation of LinkedList and subclasses
Diffstat (limited to 'src/library/scala/collection/mutable/LinkedList.scala')
-rw-r--r-- | src/library/scala/collection/mutable/LinkedList.scala | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/library/scala/collection/mutable/LinkedList.scala b/src/library/scala/collection/mutable/LinkedList.scala index 74fe104a27..8e4dbcc437 100644 --- a/src/library/scala/collection/mutable/LinkedList.scala +++ b/src/library/scala/collection/mutable/LinkedList.scala @@ -23,15 +23,24 @@ import generic._ * @since 1 */ @serializable -class LinkedList[A](_elem: A, _next: LinkedList[A]) extends LinearSeq[A] - with GenericTraversableTemplate[A, LinkedList] - with LinkedListLike[A, LinkedList[A]] { - elem = _elem - next = _next +class LinkedList[A]() extends LinearSeq[A] + with GenericTraversableTemplate[A, LinkedList] + with LinkedListLike[A, LinkedList[A]] { + next = this + + def this(elem: A, next: LinkedList[A]) { + this() + this.elem = elem + this.next = next + } + override def companion: GenericCompanion[LinkedList] = LinkedList } object LinkedList extends SeqFactory[LinkedList] { + + override def empty[A]: LinkedList[A] = new LinkedList[A] + implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, LinkedList[A]] = new GenericCanBuildFrom[A] def newBuilder[A]: Builder[A, LinkedList[A]] = (new MutableList) mapResult ((l: MutableList[A]) => l.toLinkedList) |