MCPcopy Create free account
hub / github.com/betty200744/ultimate-go / Peek

Method Peek

algorithms/data-structures/stack/stack.go:32–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 return len(s.stack) == 0
31}
32func (s *Stack) Peek() (interface{}, bool) {
33 if len(s.stack) == 0 {
34 return nil, false
35 }
36 return s.stack[0], true
37}
38func (s *Stack) Push(value interface{}) {
39 s.stack = append([]interface{}{value}, s.stack...)
40 s.len++

Callers 1

Test_StacksFunction · 0.45

Calls

no outgoing calls

Tested by 1

Test_StacksFunction · 0.36