The hashCode() method of ConcurrentLinkedDeque in Java is used to get the hashCode value for this instance of the ConcurrentLinkedDeque. It returns an integer value which is the hashCode value for this instance of the ConcurrentLinkedDeque.
Syntax:
public int hashCode()
Parameters: This function has no parameters.
Return Value: The method returns an integer value which is the hashCode value for this instance of the ConcurrentLinkedDeque.
Below programs illustrate the ConcurrentLinkedDeque.hashCode() method:
Program 1:
// Java Program Demonstrate hashCode() // method of ConcurrentLinkedDeque import java.util.concurrent.ConcurrentLinkedDeque; import java.util.*; public class GFG { public static void main(String[] args) throws IllegalStateException { // create object of ConcurrentLinkedDeque ConcurrentLinkedDeque<Integer> CLD = new ConcurrentLinkedDeque<Integer>(); // Add numbers to end of ConcurrentLinkedDeque CLD.add(7855642); CLD.add(35658786); CLD.add(5278367); CLD.add(74381793); System.out.println("Linked Blocking Deque: " + CLD); // Get the hashCode value // using hashCode() value System.out.println("HashCode value: " + CLD.hashCode()); } } |
Linked Blocking Deque: [7855642, 35658786, 5278367, 74381793] HashCode value: 2101973421
Program 2:
// Java Program Demonstrate hashCode() // method of ConcurrentLinkedDeque // when the list contains characters import java.util.concurrent.ConcurrentLinkedDeque; import java.util.*; public class GFG { public static void main(String[] args) throws IllegalStateException { // create object of ConcurrentLinkedDeque ConcurrentLinkedDeque<String> CLD = new ConcurrentLinkedDeque<String>(); // Add numbers to end of ConcurrentLinkedDeque CLD.add("1"); CLD.add("2"); CLD.add("3"); CLD.add("4"); System.out.println("Linked Blocking Deque: " + CLD); // Get the hashCode value // using hashCode() value System.out.println("HashCode value: " + CLD.hashCode()); } } |
Linked Blocking Deque: [1, 2, 3, 4] HashCode value: 2101973421
Recommended Posts:
- ConcurrentLinkedDeque add() method in Java
- ConcurrentLinkedDeque pop() method in Java with Examples
- ConcurrentLinkedDeque removeLastOccurrence() Method in Java
- ConcurrentLinkedDeque pollLast() method in Java
- ConcurrentLinkedDeque offerFirst() method in Java
- ConcurrentLinkedDeque addFirst() method in Java
- ConcurrentLinkedDeque element() method in Java
- ConcurrentLinkedDeque iterator() method in Java with Example
- ConcurrentLinkedDeque peekFirst() method in Java
- ConcurrentLinkedDeque size() method in Java
- ConcurrentLinkedDeque peek() method in Java with Example
- ConcurrentLinkedDeque getFirst() method in Java
- ConcurrentLinkedDeque addLast() method in Java
- ConcurrentLinkedDeque contains() method in Java with Examples
- ConcurrentLinkedDeque clear() method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



