File tree Expand file tree Collapse file tree 4 files changed +4
-22
lines changed Expand file tree Collapse file tree 4 files changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -57,11 +57,7 @@ public struct Stack<T> {
5757 }
5858
5959 public mutating func pop () -> T? {
60- if isEmpty {
61- return nil
62- } else {
63- return array.removeLast ()
64- }
60+ return array.popLast ()
6561 }
6662
6763 public func peek () -> T? {
Original file line number Diff line number Diff line change @@ -27,11 +27,7 @@ public struct Stack<T> {
2727 }
2828
2929 public mutating func pop( ) -> T ? {
30- if isEmpty {
31- return nil
32- } else {
33- return array. removeLast ( )
34- }
30+ return array. popLast ( )
3531 }
3632
3733 public func peek( ) -> T ? {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -19,11 +19,7 @@ public struct Stack<T> {
1919 }
2020
2121 public mutating func pop( ) -> T ? {
22- if isEmpty {
23- return nil
24- } else {
25- return array. removeLast ( )
26- }
22+ return array. popLast ( )
2723 }
2824
2925 public func peek( ) -> T ? {
@@ -34,7 +30,7 @@ public struct Stack<T> {
3430extension Stack : SequenceType {
3531 public func generate( ) -> AnyGenerator < T > {
3632 var curr = self
37- return anyGenerator {
33+ return AnyGenerator {
3834 _ -> T ? in
3935 return curr. pop ( )
4036 }
You can’t perform that action at this time.
0 commit comments