VOOZH about

URL: https://www.geeksforgeeks.org/java/copyonwritearraylist-hashcode-method-in-java/

⇱ CopyOnWriteArrayList hashCode() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CopyOnWriteArrayList hashCode() method in Java

Last Updated : 11 Jul, 2025
The hashCode() method of CopyOnWriteArrayList returns the hashCode value of the list. Syntax:
public int hashCode()
Parameters: The function does not accepts any parameter. Return Value: The function returns the hashCode value of the list. Below programs illustrate the above function: Program 1:
Output:
CopyOnWriteArrayList: [32, 67, 98, 100]
hashCode value: 1944358
Program 2:
Output:
CopyOnWriteArrayList: [gopal, gfg, jgec, sudo]
hashCode value: -1942417272
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html#hashCode--
Comment