Duration hashCode() method in Java with Examples Last Updated : 26 Nov, 2018 Comments Improve Suggest changes Like Article Like Report The hashCode() method of Duration Class in java.time package is used to get the hashCode value of this duration. Syntax: public int hashCode() Parameters: This method do not accepts any parameter. Return Value: This method returns an int value which is the hashCode value of this duration. Below examples illustrate the Duration.hashCode() method: Example 1: Java // Java code to illustrate hashCode() method import java.time.Duration; public class GFG { public static void main(String[] args) { // Duration using parse() method Duration duration = Duration.parse("P2DT3H4M"); // Get the hashCode value // using hashCode() method System.out.println(duration.hashCode()); } } Output: 183840 Example 2: Java // Java code to illustrate hashCode() method import java.time.Duration; public class GFG { public static void main(String[] args) { // Duration using ofHours() method Duration duration = Duration.ofHours(5); // Get the hashCode value // using hashCode() method System.out.println(duration.hashCode()); } } Output: 18000 Reference: https://docs.oracle.com/javase/9/docs/api/java/time/Duration.html#hashCode-- Comment More infoAdvertise with us Next Article Duration hashCode() method in Java with Examples C code_r Follow Improve Article Tags : Java Java-Functions Java-time package Java-Duration Practice Tags : Java Similar Reads Duration getSeconds() method in Java with Examples The getSeconds() method of Duration Class in java.time package is used to get the second value of this duration. Syntax: public long getSeconds() Parameters: This method do not accepts any parameter. Return Value: This method returns a long value of the seconds of this duration. Below examples illus 1 min read Double hashCode() method in Java with examples The hashCode() method of Double class is a built-in method use to return the hashcode value of this Double object. Syntax: DoubleObject.hashCode() Parameters: It takes no parameters. Return Type: It returns an int value. The value returned is (int)(v^(v>>>32)) where v is a long variable equ 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 Duration getNano() method in Java with Examples The getNano() method of Duration Class in java.time package is used to get the nanos value of this duration. Syntax: public long getNano() Parameters: This method do not accepts any parameter. Return Value: This method returns a long value of the nanos of this duration. Below examples illustrate the 1 min read Class hashCode() method in Java with Examples The hashCode() method of java.lang.Class class is used to get the hashCode representation of this entity. This method returns an integer value which is the hashCode. Syntax: public int hashCode() Parameter: This method does not accept any parameter. Return Value: This method returns an integer value 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 Calendar hashCode() Method in Java with Examples The hashCode() method in Calendar class is used to return the hash code for this Calendar Object.Syntax: public int hashCode() Parameters: The method does not take any parameters.Return Value: The method returns the hash code value for this calendar object..Below programs illustrate the working of h 2 min read Duration abs() method in Java with Examples The abs() method of Duration Class in java.time package is used to get an immutable copy of this duration with the absolute duration. Syntax: public Duration abs() Parameters: This method do not accepts any parameter. Return Value: This method returns a Duration which is an immutable copy of the exi 1 min read Duration getUnits() method in Java with Examples The getUnits() method of Duration Class in java.time package is used to get the list of units that are supported by this duration. Syntax: public List<TemporalUnit> getUnits() Parameters: This method do not accepts any parameter. Return Value: This method returns a list of units that are suppo 1 min read Like