Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Set#hash

() -> ::Integer
hash → integer

Returns the integer hash value for self.

Two sets with the same content have the same hash value.

Example
Set[0, 1].hash == Set[1, 0].hash # => true
Set[0, 1].hash == Set[0].hash    # => false