Skip to content

Commit ecee4b1

Browse files
author
Aleksandar Pokopec
committed
Changed the ctor of the LinkedList so that it i...
Changed the ctor of the LinkedList so that it ignores null if given as the next list.
1 parent 2a56692 commit ecee4b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/library/scala/collection/mutable/LinkedList.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ class LinkedList[A]() extends LinearSeq[A]
3030

3131
def this(elem: A, next: LinkedList[A]) {
3232
this()
33-
this.elem = elem
34-
this.next = next
33+
if (next != null) {
34+
this.elem = elem
35+
this.next = next
36+
}
3537
}
3638

3739
override def companion: GenericCompanion[LinkedList] = LinkedList

0 commit comments

Comments
 (0)