MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Get

Method Get

structure/dynamicarray/dynamicarray.go:67–75  ·  view source on GitHub ↗

Get function is return one element with the index of array

(index int)

Source from the content-addressed store, hash-verified

65
66// Get function is return one element with the index of array
67func (da *DynamicArray) Get(index int) (any, error) {
68 err := da.CheckRangeFromIndex(index)
69
70 if err != nil {
71 return nil, err
72 }
73
74 return da.ElementData[index], nil
75}
76
77// IsEmpty function is check that the array has value or not
78func (da *DynamicArray) IsEmpty() bool {

Callers 1

TestDynamicArrayFunction · 0.95

Calls 1

CheckRangeFromIndexMethod · 0.95

Tested by 1

TestDynamicArrayFunction · 0.76