diff --git a/Singly Linked List/README.markdown b/Singly Linked List/README.markdown index b3c8b8b2d..6d896db88 100644 --- a/Singly Linked List/README.markdown +++ b/Singly Linked List/README.markdown @@ -52,10 +52,8 @@ SEARCH Collections are sequences, therefore the first step is to conform to the Sequence protocol. ``` -extension SinglyLinkedList : Sequence -{ - public func makeIterator() -> SinglyLinkedListForwardIterator - { +extension SinglyLinkedList: Sequence { + public func makeIterator() -> SinglyLinkedListForwardIterator { return SinglyLinkedListForwardIterator(head: self.storage.head) } } @@ -70,8 +68,7 @@ public struct SinglyLinkedListForwardIterator : IteratorProtocol { private(set) var head: SinglyLinkedListNode? - mutating public func next() -> T? - { + mutating public func next() -> T? { let result = self.head?.value self.head = self.head?.next return result @@ -82,8 +79,7 @@ public struct SinglyLinkedListForwardIterator : IteratorProtocol { Next, a collection needs to be indexable. Indexes are implemented by the data structure class. We have encapsulated this knowledge in instances of the class `SinglyLinkedListIndex`. ``` -public struct SinglyLinkedListIndex : Comparable -{ +public struct SinglyLinkedListIndex: Comparable { fileprivate let node: SinglyLinkedListNode? fileprivate let tag: Int