ChronoPeriod hashCode() method in Java with Examples Last Updated : 27 Jun, 2019 Comments Improve Suggest changes Like Article Like Report The hashCode() method of ChronoPeriod class in Java is used to get the generated hashCode for this period. Syntax: 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 hashCode() method in Java: Program 1: Java // Java code to show the function hashCode() // to get the hashCode for the given period import java.time.*; import java.time.chrono.*; import java.time.temporal.ChronoUnit; public class ChronoPeriodDemo { // Function to generate hashCode for the given period static void getNumberOfDays(int year, int months, int days) { ChronoPeriod period = Period.of(year, months, days); System.out.println(period.hashCode()); } // Driver Code public static void main(String[] args) { int year = 12; int months = 3; int days = 31; getNumberOfDays(year, months, days); } } Output: 2032396 Program 2: Java // Java code to show the function hashCode() // to get the hashCode for the given period import java.time.*; import java.time.chrono.*; import java.time.temporal.ChronoUnit; public class ChronoPeriodDemo { // Function to generate hashCode for the given period static void getNumberOfDays(int year, int months, int days) { ChronoPeriod period = Period.of(year, months, days); System.out.println(period.hashCode()); } // Driver Code public static void main(String[] args) { int year = -12; int months = 3; int days = 31; getNumberOfDays(year, months, days); } } Output: 2032372 Reference: https://docs.oracle.com/javase/9/docs/api/java/time/chrono/ChronoPeriod.html#hashCode-- Comment More infoAdvertise with us Next Article ChronoPeriod hashCode() method in Java with Examples S srinam Follow Improve Article Tags : Java Java-Functions Java-Time-Chrono package Java-ChronoPeriod Practice Tags : Java Similar Reads ChronoLocalDate hashCode() method in Java with Examples The hashCode() method of ChronoLocalDate interface in Java is used to get the hashCode value of this ChronoLocalDate object in the integer form. Syntax: public int hashCode() Parameter: This method does not accepts any parameter. Return Value: The function returns a suitable hash code in the form of 1 min read Charset hashCode() method in Java with Examples The hashCode() method is a built-in method of the java.nio.charset returns the computed hashcode of any given charset. Syntax: public final int hashCode() Parameters: The function does not accepts any parameter. Return Value: The function returns the computed hashcode for the charset. Below is the i 1 min read Constructor hashCode() method in Java with Examples The hashCode() method of java.lang.reflect.Constructor class is used to return a hashcode for this Constructor object. The hashcode is always the same if the constructed object doesnât change. Hashcode is a unique code generated by the JVM at the time of class object creation. We can use hashcode to 2 min read CompoundName hashCode() method in Java with Examples The hashCode() method of a javax.naming.CompoundName class is used to return the hash code of this compound name. The hash code of this compound name object is the sum of the hash codes of the "canonicalized" forms of individual components of this compound name. Syntax: public int hashCode() Paramet 2 min read Collator hashCode() method in Java with Example The hashCode() method of java.text.Collator class is used to get the hashCode for this Collator object. Syntax: public abstract int hashCode() Parameter: This method does not accept any parameter.Return Value: This method returns hash code value in integer format. Below are the examples to illustrat 2 min read Boolean hashCode() method in Java with examples The hashCode() method of Boolean class is a built in method to return a int hashcode value corresponding to the Boolean object. Syntax BooleanObject.hashCode() Return Type: It returns a int hashcode value corresponding to the Boolean object. It returns 1231 if the Boolean object stores the value tru 1 min read ChronoZonedDateTime hashCode() method in Java with Examples The hashCode() method of a ChronoZonedDateTime interface is used to get the hashcode for this ChronoZonedDateTime. Hashcode is a unique code generated by the JVM at the time of object creation. It can be used to perform some operation on hashing related algorithm like a hashtable, hashmap etc. An ob 1 min read ChoiceFormat hashCode() method in Java with Examples The hashCode() method of java.text.ChoiceFormat class is used to get the hash code for choice format object. This hashcode value is returned as an integer. Syntax: public int hashCode() Parameter: This method does not accept any parameter. Return Value: This method returns hash code for choice forma 2 min read ChronoLocalDateTime hashCode() method in Java with Examples The hashCode() method of ChronoLocalDateTime interface in Java is used to get the hashCode value for this ChronoLocalDateTime object. Syntax: int hashCode() Parameter: This method do not accepts any parameter. Return Value: It returns an integer value which is the hashCode value for this ChronoLocal 1 min read Byte hashCode() method in Java with examples The hashCode() method of Byte class is a built in method in Java which is used to return the hash code of the ByteObject. Note: The hashCode() returns the same value as intValue(). Syntax ByteObject.hashCode() Return Value: It return an int value which represents the hashcode of the specified Byte o 2 min read Like