ConcurrentLinkedDeque hashCode() method in Java with Example
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:
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.*;
public class GFG {
public static void main(String[] args)
throws IllegalStateException
{
ConcurrentLinkedDeque<Integer> CLD
= new ConcurrentLinkedDeque<Integer>();
CLD.add( 7855642 );
CLD.add( 35658786 );
CLD.add( 5278367 );
CLD.add( 74381793 );
System.out.println( "Linked Blocking Deque: " + CLD);
System.out.println( "HashCode value: "
+ CLD.hashCode());
}
}
|
Output:
Linked Blocking Deque: [7855642, 35658786, 5278367, 74381793]
HashCode value: 2101973421
Program 2:
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.*;
public class GFG {
public static void main(String[] args)
throws IllegalStateException
{
ConcurrentLinkedDeque<String> CLD
= new ConcurrentLinkedDeque<String>();
CLD.add( "1" );
CLD.add( "2" );
CLD.add( "3" );
CLD.add( "4" );
System.out.println( "Linked Blocking Deque: " + CLD);
System.out.println( "HashCode value: "
+ CLD.hashCode());
}
}
|
Output:
Linked Blocking Deque: [1, 2, 3, 4]
HashCode value: 2101973421
Last Updated :
27 Dec, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...