87
Java List hashCode() Method
The hashCode() method of List interface returns the hash code value for this list.
Syntax
Parameters
NA
Specified By
hashcode in interface Collection<E>
Overrides
This method overrides hashCode in class Object
Returns
The hashCode() method returns the hash code value for this list.
Example 1
Output:
Hash Code for 5 : 5 Hash Code for 51 : 51 Hash Code for 52 : 52
Example 2
Output:
Hash Code : -1772261557
Example 3
Output:
Exception in thread "main" java.lang.NullPointerException at com.tutorAspire.JavaListHashCodeExample3.main(JavaListHashCodeExample3.java:12)
Next TopicJava List