Java UUID - hashCode() Method
The java.util.UUID.hashCode() method returns a hash code for this UUID.
Syntax
public int hashCode()
Parameters
No parameter is required.
Return Value
Returns a hash code value for this UUID.
Exception
NA.
Example:
In the example below, the java.util.UUID.hashCode() method returns the hash code value for the given UUID.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating an UUID UUID uid = UUID.fromString("d81e4f2e-cdf2-10e6-529b-7df92533d1cb"); //printing the hash code of the uuid System.out.println("hashCode of uid is: " + uid.hashCode()); } }
The output of the above code will be:
hashCode of uid is: 1648686074
❮ Java.util - UUID