VOOZH about

URL: https://www.geeksforgeeks.org/java/list-hashcode-method-in-java-with-examples/

⇱ List hashCode() Method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

List hashCode() Method in Java with Examples

Last Updated : 3 Dec, 2024

This method is used to generate the hashCode for the given list.

Implementation:


Output
HashCode : 994

Syntax of Method

int hashCode()

  • Parameters: This function has no parameter.
  • Returns: This function returns the hashCode value for the given list.

Example of List hashCode() Method

Below programs show the implementation of this method.

Program 1:


Output
[10, 15, 20]
HashCode of List : 39886

Program 2: Below is the code to show implementation of list.hashCode() using Linkedlist.


Output
[10, 15, 20]
HashCode of List : 1586008

Reference: Oracle Docs

Comment