WeekFields hashCode() method in Java with Examples Last Updated : 29 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The hashCode() method of WeekFields class is used to return the hash code for this WeekFields.It returns an integer value which is the hashCode value for this instance of the ValueRange. Syntax: public int hashCode() Parameters: This method accepts nothing. Return value: This method returns integer value which is the hashCode value. Below programs illustrate the WeekFields.hashCode() method: Program 1: Java // Java program to demonstrate // WeekFields.hashCode() method import java.time.DayOfWeek; import java.time.temporal.WeekFields; public class GFG { public static void main(String[] args) { // create WeekFields WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1); // apply hashCode() int hashCode = weekFields.hashCode(); // print results System.out.println("Hash Code:" + hashCode); } } Output: Hash Code:1 Program 2: Java // Java program to demonstrate // WeekFields.hashCode() method import java.time.DayOfWeek; import java.time.temporal.WeekFields; import java.util.Locale; public class GFG { public static void main(String[] args) { Locale locale = new Locale("EN", "US"); // create WeekFields WeekFields weekFields = WeekFields.of(locale); // apply hashCode() int hashCode = weekFields.hashCode(); // print results System.out.println("Hash Code:" + hashCode); } } Output: Hash Code:43 References: https://docs.oracle.com/javase/10/docs/api/java/time/temporal/WeekFields.html#hashCode() Comment More infoAdvertise with us Next Article WeekFields hashCode() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.time.temporal package Java-WeekFields Practice Tags : Java Similar Reads Period hashCode() method in Java with Examples The hashCode() method of Period class in Java is used to get the generated hashCode for this period. Syntax: public int hashCode() Parameters: This method does not accepts any parameter. Return Value: This method returns the hashCode generated for the given period. Below programs illustrate the hash 2 min read UUID hashCode() Method in Java with Examples The hashCode() method of UUID class in Java is generally used to get the hash code value of the UUID. Syntax: public int hashCode() Parameters: This method does not take any parameter. Return Value: This method returns an integer value which is the hashCode value for this UUID instance. Below progra 1 min read Properties hashCode() method in Java with Examples The hashCode() method of Properties class is used to generate a hashCode for the given Properties containing key and values. Syntax: public int hashCode() Parameters: This method has no argument. Returns: This method returns the hashCode value for the given map. Below programs show the implementatio 2 min read TreeSet hashCode() method in Java with Example The hashCode() method of TreeSet in Java is used to get the hashCode value for this instance of the TreeSet. It returns an integer value which is the hashCode value for this instance of the TreeSet. Syntax: public int hashCode() Parameters: This function has no parameters. Returns: The method return 2 min read SortedSet hashCode() method in Java with Examples 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 2 min read Short hashCode() method in Java with Examples The hashCode() method of Short class is a built in method in Java which is used to return the hash code of the ShortObject. Note: The hashCode() returns the same value as intValue(). Syntax ShortObject.hashCode() Return Value: It return an int value which represents the hashcode of the specified Sho 2 min read Package hashCode() method in Java with Examples The hashCode() method of java.lang.Package class is used to get the hashCode value of this package instance. The method returns the hashCode value as an integer value.Syntax: public int hashCode() Parameter: This method does not accepts any parameter.Return Value: This method returns the hashCode va 2 min read Optional hashCode() method in Java with examples The hashCode() method of java.util.Optional class in Java is used to get the hashCode value of this Optional instance. If there is no value present in this Optional instance, then this method returns 0. Syntax: public int hashCode() Parameter: This method do not accepts any parameter. Return Value: 1 min read StringWriter hashCode() method in Java with Examples The hashCode() method of StringWriter Class in Java is used to get the HashCode value of this StringWriter instance. This method does not accepts any parameter and returns the required int value. Syntax: public int hashCode() Parameters: This method accepts does not accepts any parameter. Return Val 2 min read SortedMap hashCode() method in Java with Examples The hashCode() method of SortedMap interface in Java is used to generate a hashCode for the given map containing key and values. Syntax: int hashCode() Parameters: This method has no argument. Returns: This method returns the hashCode value for the given map. Note: The hashCode() method in SortedMap 2 min read Like