return nil
}
-// Peek lets you see and edit the top value of the stack without popping it
-func (s *Stack) Peek() *interface{} {
+// Peek returns the top element of the stack without removing it
+func (s *Stack) Peek() interface{} {
if s.size > 0 {
- return &s.top.value
+ return s.top.value
}
return nil
}