Returns a random element of the set if it is nonEmpty otherwise throws IllegalArgumentException. Note that currently a near- but no true-uniform distribution is granted to allow for O(1) implementation.
Returns a random element of the set if it is nonEmpty otherwise throws IllegalArgumentException. Note that currently a near- but no true-uniform distribution is granted to allow for O(1) implementation.
Value parameters
random
a random generator; it is essential that random be instantiated by the caller just once for any sequence of calls
Attributes
def findElem[B](toMatch: B, correspond: (A, B) => Boolean): A
Finds an entry in the collection based on toMatch's hashCode and a correspondence function but not on the argument type.
Finds an entry in the collection based on toMatch's hashCode and a correspondence function but not on the argument type.
Value parameters
correspond
function returning whether a given entry corresponds to other
toMatch
a value not necessarily of type A; the entry to be searched for must have the same hashCode and be equal to this argument
Attributes
Returns
the entry corresponding to toMatch or null if not contained