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: