setCount

abstract fun setCount(element: E, count: Int): Int(source)

Adds or removes the necessary occurrences of an element such that the element attains the desired count.

Return

the count of the element before the operation; possibly zero

See also

Parameters

element

the element to add or remove occurrences of; may be null only if explicitly allowed by the implementation

count

the desired count of the element in this multiset

Throws

if count is negative


abstract fun setCount(element: E, oldCount: Int, newCount: Int): Boolean(source)

Conditionally sets the count of an element to a new value, as described in setCount, provided that the element has the expected current count. If the current count is not oldCount, no change is made.

Return

true if the condition for modification was met. This implies that the multiset was indeed modified, unless oldCount == newCount.

See also

Parameters

element

the element to conditionally set the count of; may be null only if explicitly allowed by the implementation

oldCount

the expected present count of the element in this multiset

newCount

the desired count of the element in this multiset