Exemple #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
}
Exemple #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
}
Exemple #3
0
func NewMap() *Map {
	l := list.NewList()
	i := list.NewIterator(l)
	return &Map{l, i}
}