Ejemplo n.º 1
0
func (m *Map) Contains(key interface{}) bool {
	i := list.NewIterator(m.buckets)

	for i.First(); !i.IsDone(); i.Next() {
		c := i.Current().GetValue().(*KeyValue)

		if c.Equals(key) {
			return true
		}
	}
	return false
}
Ejemplo n.º 2
0
func (m *Map) Get(key interface{}) interface{} {
	i := list.NewIterator(m.buckets)

	for i.First(); !i.IsDone(); i.Next() {
		c := i.Current().GetValue().(*KeyValue)

		if c.Equals(key) {
			return c.Value
		}
	}
	return nil
}
Ejemplo n.º 3
0
func NewMap() *Map {
	l := list.NewList()
	i := list.NewIterator(l)
	return &Map{l, i}
}