func (t *LLRB) ReplaceOrInsert(item Item) Item {
	if item == nil {
		panic("inserting nil item")
	}
	var replaced Item
	t.root, replaced = t.replaceOrInsert(t.root, item)
	t.root.Black = true
	if replaced == nil {
		t.count++
	}
	return replaced
}
ReplaceOrInsert inserts item into the tree. If an existing
element has the same order, it is removed from the tree and returned.
package llrb
type LLRB struct {
	count int
	root  *Node
}
type Node struct {
	Item
	Left, Right *Node  
	Black       bool   
}
type Item interface {
	Less(than Item) bool
}
func less(x, y Item) bool {
	if x == pinf {
		return false
	}
	if x == ninf {
		return true
	}
	return x.Less(y)
}
func Inf(sign int) Item {
	if sign == 0 {
		panic("sign")
	}
	if sign > 0 {
		return pinf
	}
	return ninf
}
var (
	ninf = nInf{}
	pinf = pInf{}
)
type nInf struct{}
func (nInf) Less(Item) bool {
	return true
}
type pInf struct{}
func (pInf) Less(Item) bool {
	return false
}
func New() *LLRB {
	return &LLRB{}
}
func (t *LLRB) SetRoot(r *Node) {
	t.root = r
}
func (t *LLRB) Root() *Node {
	return t.root
}
func (t *LLRB) Len() int { return t.count }
func (t *LLRB) Has(key Item) bool {
	return t.Get(key) != nil
}
func (t *LLRB) Get(key Item) Item {
	h := t.root
	for h != nil {
		switch {
		case less(key, h.Item):
			h = h.Left
		case less(h.Item, key):
			h = h.Right
		default:
			return h.Item
		}
	}
	return nil
}
func (t *LLRB) Min() Item {
	h := t.root
	if h == nil {
		return nil
	}
	for h.Left != nil {
		h = h.Left
	}
	return h.Item
}
func (t *LLRB) Max() Item {
	h := t.root
	if h == nil {
		return nil
	}
	for h.Right != nil {
		h = h.Right
	}
	return h.Item
}
func (t *LLRB) ReplaceOrInsertBulk(items ...Item) {
	for _, i := range items {
		t.ReplaceOrInsert(i)
	}
}
func (t *LLRB) InsertNoReplaceBulk(items ...Item) {
	for _, i := range items {
		t.InsertNoReplace(i)
	}
}