indexOf

fun indexOf(key: Int): Int

Returns a logical "index" of a given key that can be used to speed up follow-up logic in certain scenarios (conditional logic).

The semantics of "indexes" are not strictly defined. Indexes may (and typically won't be) contiguous.

The index is valid only between modifications (it will not be affected by read-only operations).

Return

A non-negative value of the logical "index" of the key in the set or a negative value if the key did not exist.

Parameters

key

The key to locate in the set.

See also

.indexReplace