MCPcopy Create free account
hub / github.com/0xAX/go-algorithms / Peek

Method Peek

stack/stack.go:41–47  ·  view source on GitHub ↗

Peek returns top of a stack without deletion

()

Source from the content-addressed store, hash-verified

39
40// Peek returns top of a stack without deletion
41func (stack *Stack) Peek() interface{} {
42 if stack.depth > 0 {
43 return stack.sp.item
44 }
45
46 return nil
47}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected