It puzzles me how the following segment can lead to a null value of the Boolean mandatory, although it is not null at the corresponding key in the actual hashtable:
for (List<List<A>> a : hashMap.keySet()) {
Boolean mandatory = hashMap.get(a);
}
A HashMap will return
nullif the key specified is not bound to a value.Issue is almost certainly that comparison op on
a— a List — against keys is failing.Let me guess: are you modifying these lists (the key object) after you have called a put? Did you remove all entries in one of the keys? Remember an empty list is
equalto all empty ArrayLists. Further remember that List.equals() compares list content (one by one) to test equality.Results:
edit: added more ops to above and added console out.