We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71ae5a3 commit bd7e4b1Copy full SHA for bd7e4b1
Linked List/LinkedList.playground/Contents.swift
@@ -72,6 +72,8 @@ public final class LinkedList<T> {
72
/// - Returns: Optional LinkedListNode
73
public func node(atIndex index: Int) -> Node {
74
assert(head != nil, "List is empty")
75
+ assert(index >= 0, "index must be greater than 0")
76
+
77
if index == 0 {
78
return head!
79
} else {
0 commit comments