// Add an element into the sorted set with specific key / value / score.
// if the element is added, this method returns true; otherwise false means updated
//
// Time complexity of this method is : O(log(N))
Add an element into the sorted set with specific key / value / score.
if the element is added, this method returns true; otherwise false means updated

Time complexity of this method is : O(log(N))
// Add an element into the sorted set with specific key / value / score . // if the element is added this method returns true ; otherwise false means updated // // Time complexity of this method is : O ( log ( N ))
func (this *SortedSet) AddOrUpdate(key string, score SCORE, value interface{}) bool {
	var newNode *SortedSetNode = nil
	this.mutex.Lock()
	defer this.mutex.Unlock()
	found := this.dict[key]
	if found != nil {
		if found.score == score {
			found.Value = value
		} else { 
			this.delete(found.score, found.key)
			newNode = this.insertNode(score, key, value)
		}
	} else {
		newNode = this.insertNode(score, key, value)
	}
	if newNode != nil {
		this.dict[key] = newNode
	}
	return found == nil
}
func ( this * SortedSet ) AddOrUpdate ( key string , score SCORE , value interface { } ) bool { var newNode * SortedSetNode = nil this . mutex . Lock ( ) defer this . mutex . Unlock ( ) found := this . dict [ key ] if found != nil { if found . score == score { found . Value = value } else { this . delete ( found . score , found . key ) newNode = this . insertNode ( score , key , value ) } } else { newNode = this . insertNode ( score , key , value ) } if newNode != nil { this . dict [ key ] = newNode } return found == nil }
Add an element into the sorted set with specific key / value / score.
Add an element into the sorted set with specific key / value / score .
// score does not change, only update value // score changes, delete and re-insert