Using this method we can find out the hash code for the invoking collection.
Collection Interface hashCode() Method:
Using this method we can find out the hash code for the invoking collection.
Syntax :
int hashCode();
Example :
import java.util.ArrayList;
import java.util.List;
public class CollectionInterfaceHashCodeMethod {
public static void main(String[] args) {
List arraylist = new ArrayList();
arraylist.add("Deepak");
arraylist.add("Kumar");
int hashcode = arraylist.hashCode();
System.out.println("hashcode = " + hashcode);
}
}
Output :
| hashcode = -1013147681 |

[ 0 ] Comments