MCPcopy Create free account
hub / github.com/ardanlabs/gotraining / Make

Function Make

topics/go/algorithms/data/stack/stack.go:22–26  ·  view source on GitHub ↗

Make allows the creation of a stack with an initial capacity for efficiency. Otherwise a stack can be used in its zero value state.

(cap int)

Source from the content-addressed store, hash-verified

20// capacity for efficiency. Otherwise a stack can be
21// used in its zero value state.
22func Make(cap int) *Stack {
23 return &Stack{
24 data: make([]*Data, 0, cap),
25 }
26}
27
28// Count returns the number of items in the stack.
29func (s *Stack) Count() int {

Callers 1

TestPeekFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestPeekFunction · 0.74