I have three hashmaps, 2 of them have multiple values (arrayLists).
Map<String, String> advise = new HashMap<String, String>();
    Map<String, ArrayList<String>> teach = new HashMap<String,ArrayList<String>>();
    Map<String, ArrayList<String>> takesCo = new HashMap<String,ArrayList<String>>();
    //ArrayList<String> courses = new ArrayList<String>; 
I want to iterate over them based on the key of the first hashmap (advise) The array lists contain course names and I want to print when there is a match.
for (String x : advise.keySet()) { 
    String y = advise.get(x);
    ArrayList<String> z1values = teach.get(y) ;
    ArrayList<String> z2values = takesCo.get(x) ;
    if (!z1values.isEmpty() && !z2values.isEmpty()){
    for (String z1:z1values){
        for (String z2:z2values){
            if (z1.equals(z2)){
                result=x+","+y+","+z1;
                system.out.println(result);
                }
            }
        }
    }
}
I get nullPointerException in line with the if statement
 
     
    