Open In App

SortedSet hashCode() method in Java with Examples

Last Updated : 30 Sep, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The hashCode() method of SortedSet in Java is used to get the hashCode value for this instance of the SortedSet. It returns an integer value which is the hashCode value for this instance of the SortedSet. Syntax:
public int hashCode()
Parameters: This function has no parameters. Returns: The method returns an integer value which is the hashCode value for this instance of the Set. Note: The hashCode() method in SortedSet is inherited from the Set interface in Java. Below examples illustrates the SortedSet.hashCode() method: Example 1:
Output:
Set: [1, 2, 3, 4]
HashCode value: 10
Example 2:
Output:
Set: [For, ForGeeks, Geeks, GeeksForGeeks]
HashCode value: -482506029
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Set.html#hashCode()

Next Article
Practice Tags :

Similar Reads