My Program is public class Demo {
public static void main(String[] args) {
List<String> arr = new ArrayList<>();
arr.add("a");
arr.add("b");
Map<List<String>, String> map = new HashMap<>();
map.put(arr, "Ravinda");
System.out.println(map.get(arr));
arr.add("c");
System.out.println(map.get(arr));
}
}
Output is: Ravindra and null
I am not able to get why the output of second System.out.println is null.
Can anyone please explain.