@@ -125,19 +125,19 @@ public struct SinglyLinkedList<T> {
125
125
var i = 0
126
126
var elementToDelete : SinglyLinkedListNode < T >
127
127
128
- while ( i < index) {
128
+ while i < index {
129
129
previous = current
130
130
current = current? . next
131
131
i += 1
132
132
}
133
133
134
134
// Current is now the element to delete (at index position.tag)
135
135
elementToDelete = current!
136
- if ( storage. head === current) {
136
+ if storage. head === current {
137
137
storageForWritting. head = current? . next
138
138
}
139
139
140
- if ( storage. tail === current) {
140
+ if storage. tail === current {
141
141
storageForWritting. tail = previous
142
142
}
143
143
@@ -164,7 +164,7 @@ public struct SinglyLinkedList<T> {
164
164
165
165
let i = ( count - kthToLast)
166
166
167
- if ( i == 0 ) {
167
+ if i == 0 {
168
168
return node
169
169
}
170
170
@@ -243,7 +243,7 @@ private extension SinglyLinkedList {
243
243
// Iterate through current list of nodes and copy them.
244
244
var current : SinglyLinkedListNode < T > ? = storage. head? . next
245
245
246
- while ( current != nil ) {
246
+ while current != nil {
247
247
// Create a copy
248
248
let currentCopy = SinglyLinkedListNode < T > ( value: current!. value)
249
249
@@ -283,11 +283,11 @@ extension SinglyLinkedList where T: Comparable {
283
283
284
284
if let foundNode = current {
285
285
286
- if ( storage. head === foundNode) {
286
+ if storage. head === foundNode {
287
287
storageForWritting. head = foundNode. next
288
288
}
289
289
290
- if ( storage. tail === foundNode) {
290
+ if storage. tail === foundNode {
291
291
storage. tail = previous
292
292
}
293
293
@@ -303,18 +303,18 @@ extension SinglyLinkedList where T: Comparable {
303
303
// Copy on write: this updates storage if necessary.
304
304
var current = storageForWritting. head
305
305
306
- while ( current != nil ) {
306
+ while current != nil {
307
307
var previous : SinglyLinkedListNode < T > ? = current
308
308
var next = current? . next
309
309
310
- while ( next != nil ) {
311
- if ( current? . value == next? . value) {
310
+ while next != nil {
311
+ if current? . value == next? . value {
312
312
313
- if ( storage. head === next) {
313
+ if storage. head === next {
314
314
storage. head = next? . next
315
315
}
316
316
317
- if ( storage. tail === next) {
317
+ if storage. tail === next {
318
318
storage. tail = previous
319
319
}
320
320
@@ -461,7 +461,7 @@ func findTail<T>(in node: SinglyLinkedListNode<T>) -> (tail: SinglyLinkedListNod
461
461
var current : SinglyLinkedListNode < T > ? = node
462
462
var count = 1
463
463
464
- while ( current? . next != nil ) {
464
+ while current? . next != nil {
465
465
current = current? . next
466
466
count += 1
467
467
}
0 commit comments