func (t *ThresholdMap) Ceiling(key interface{}) (floorKey interface{}, floorValue interface{}, exists bool) {
	if node, exists := t.tree.Ceiling(key); exists {
		return node.Key, node.Value, true
	}
	return nil, nil, false
}
Ceiling returns the smallest key that is >= the given key, it's value and a boolean flag indicating if it exists.
package thresholdmap
import (
	"github.com/emirpasic/gods/trees/redblacktree"
	"github.com/emirpasic/gods/utils"
	"github.com/iotaledger/hive.go/datastructure/genericcomparator"
)
type ThresholdMap struct {
	mode Mode
	tree *redblacktree.Tree
}
func New(mode Mode, optionalComparator ...genericcomparator.Type) *ThresholdMap {
	if len(optionalComparator) >= 1 {
		return &ThresholdMap{
			mode: mode,
			tree: redblacktree.NewWith(utils.Comparator(optionalComparator[0])),
		}
	}
	return &ThresholdMap{
		mode: mode,
		tree: redblacktree.NewWith(genericcomparator.Comparator),
	}
}
func (t *ThresholdMap) Set(key interface{}, value interface{}) {
	t.tree.Put(key, value)
}
func (t *ThresholdMap) Get(key interface{}) (value interface{}, exists bool) {
	var foundNode *redblacktree.Node
	switch t.mode {
	case UpperThresholdMode:
		foundNode, exists = t.tree.Ceiling(key)
	case LowerThresholdMode:
		foundNode, exists = t.tree.Floor(key)
	default:
		panic("unsupported mode")
	}
	if exists {
		value = foundNode.Value
	}
	return
}
func (t *ThresholdMap) Floor(key interface{}) (floorKey interface{}, floorValue interface{}, exists bool) {
	if node, exists := t.tree.Floor(key); exists {
		return node.Key, node.Value, true
	}
	return nil, nil, false
}