func (p *Pair) Prev() *Pair {
	return listElementToPair(p.element.Prev())
}
Previous returns a pointer to the previous pair.
package orderedmap
import (
	"container/list"
)
type Pair struct {
	Key   interface{}
	Value interface{}
	element *list.Element
}
type OrderedMap struct {
	pairs map[interface{}]*Pair
	list  *list.List
}
func New() *OrderedMap {
	return &OrderedMap{
		pairs: make(map[interface{}]*Pair),
		list:  list.New(),
	}
}
func (om *OrderedMap) Get(key interface{}) (interface{}, bool) {
	if pair, present := om.pairs[key]; present {
		return pair.Value, present
	}
	return nil, false
}
func (om *OrderedMap) GetPair(key interface{}) *Pair {
	return om.pairs[key]
}
func (om *OrderedMap) Set(key interface{}, value interface{}) (interface{}, bool) {
	if pair, present := om.pairs[key]; present {
		oldValue := pair.Value
		pair.Value = value
		return oldValue, true
	}
	pair := &Pair{
		Key:   key,
		Value: value,
	}
	pair.element = om.list.PushBack(pair)
	om.pairs[key] = pair
	return nil, false
}
func (om *OrderedMap) Delete(key interface{}) (interface{}, bool) {
	if pair, present := om.pairs[key]; present {
		om.list.Remove(pair.element)
		delete(om.pairs, key)
		return pair.Value, true
	}
	return nil, false
}
func (om *OrderedMap) Len() int {
	return len(om.pairs)
}
func (om *OrderedMap) Oldest() *Pair {
	return listElementToPair(om.list.Front())
}
func (om *OrderedMap) Newest() *Pair {
	return listElementToPair(om.list.Back())
}
func (p *Pair) Next() *Pair {
	return listElementToPair(p.element.Next())
}