fix LinkedList definition

This commit is contained in:
Martijn Hoekstra 2019-01-17 14:29:46 +01:00 committed by GitHub
parent c8fe7c882e
commit 5fdbeef261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -823,11 +823,10 @@ Consider the class definition
```scala
class LinkedList[A]() {
var head = _
var tail = null
def isEmpty = tail != null
var head: A = _
var tail: LinkedList[A] = null
def this(head: A) = { this(); this.head = head }
def this(head: A, tail: List[A]) = { this(head); this.tail = tail }
def this(head: A, tail: LinkedList[A]) = { this(head); this.tail = tail }
}
```