ArrayList.hashCode(): This method is available in java.util.ArrayList class of Java.
Syntax:
int java.util.ArrayList.hashCode()
This method returns the hash code value for this list.
Parameters: NA
Returns: the hash code value for this list.
Exceptions: NA
Approach
Java
import java.util.ArrayList;public class ArrayListhashCode {public static void main(String[] args) {ArrayList<Integer> arr = new ArrayList<>();arr.add(1);arr.add(2);arr.add(3);System.out.println(arr.hashCode());}}
Output:
30817
No comments:
Post a Comment