UUID equals() Method in Java with Examples
The equals() method of UUID class in Java is used to check for the equality of one UUID with another. The method returns True if both the UUID’s are exactly identical bit by bit.
public boolean equals(Object uuidObj)
Parameters: The method takes one parameter uuidObj to which the UUID_1 is to be compared.
Return Value: The method returns true if both the UUIDs are identical else false.
Below programs illustrate the working of equals() method:
UUID_1: 14534 UUID_2: 14534 Are both UUID equal: true
UUID_1: 14534 UUID_2: 5737 Are both UUID equal: false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.