Instant hashCode() method in Java with Examples Last Updated : 27 Nov, 2018 Comments Improve Suggest changes Like Article Like Report The hashCode() method of Instant Class is used to get hashCode for this Instant. The hashcode is always the same if the object doesn’t change. Hashcode is a unique code generated by the JVM at time of object creation. It can be used to perform some operation on hashing related algorithm like hashtable, hashmap etc. An object can also be searched with its unique code (hashcode). Syntax: public int hashCode() Returns: This method returns the hashCode for this Instant. Below programs illustrate the Instant.hashCode() method: Program 1: Java // Java program to demonstrate // Instant.hashCode() method import java.time.*; public class GFG { public static void main(String[] args) { // create a Instant object Instant instant = Instant.parse("2018-12-30T19:34:50.63Z"); // get hashCode // using hashCode() int value = instant.hashCode(); // print result System.out.println("hashCode value: " + value); } } Output: hashCode value: -683539878 Program 2: Java // Java program to demonstrate // Instant.hashCode() method import java.time.*; public class GFG { public static void main(String[] args) { // create a Instant object Instant instant = Instant.now(); // current Instant System.out.println("Current Instant: " + instant); // get hashCode // using hashCode() int value = instant.hashCode(); // print result System.out.println("hashCode value: " + value); } } Output: Current Instant: 2018-11-27T04:45:52.428Z hashCode value: 1896457472 References: https://docs.oracle.com/javase/10/docs/api/java/time/Instant.html#hashCode() Comment More infoAdvertise with us Next Article Instant hashCode() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java - util package Java-Functions Java-Instant Practice Tags : Java Similar Reads Instant from() method in Java with Examples The from() method of Instant class helps to get instance of instant from TemporalAccessor object passed as parameter. A TemporalAccessor represents an arbitrary set of date and time information and this method helps to get an instant based on the specified TemporalAccessor object. The conversion of 2 min read JapaneseDate hashCode() method in Java with Example The hashCode() method of java.time.chrono.JapaneseDate class is used to get the hash code for the particular japanese date. Syntax: public int hashCode() Parameter: This method does not accept any argument as a parameter. Return Value: This method returns the hash code for the particular japanese da 2 min read List hashCode() Method in Java with Examples This method is used to generate the hashCode for the given list. Implementation:Java// Java code to show the implementation of // hashCode method in list interface import java.util.*; public class Main { public static void main(String[] args) { // Initializing a list List<Integer> l = new Arra 2 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 Year hashCode() method in Java with Examples The hashCode() method of Year class in Java is used to get a suitable hash code for the current Year object. Syntax: public int hashCode() Parameter: This method does not accepts any parameter. Return Value: It returns a suitable integral hash code for the year object with which it is used. It never 1 min read Like