MCPcopy
hub / github.com/cornelk/hashmap / String

Method String

hashmap.go:200–216  ·  view source on GitHub ↗

String returns the map as a string, only hashed keys are printed.

()

Source from the content-addressed store, hash-verified

198
199// String returns the map as a string, only hashed keys are printed.
200func (m *Map[Key, Value]) String() string {
201 buffer := bytes.NewBufferString("")
202 buffer.WriteRune('[')
203
204 first := m.linkedList.First()
205 item := first
206
207 for item != nil {
208 if item != first {
209 buffer.WriteRune(',')
210 }
211 fmt.Fprint(buffer, item.keyHash)
212 item = item.Next()
213 }
214 buffer.WriteRune(']')
215 return buffer.String()
216}
217
218// Range calls f sequentially for each key and value present in the map.
219// If f returns false, range stops the iteration.

Callers 1

TestStringerFunction · 0.80

Calls 2

FirstMethod · 0.80
NextMethod · 0.80

Tested by 1

TestStringerFunction · 0.64