You need to sign in to do that
Don't have an account?
Kellan Scheiber
I have the below where I am trying to map an String to an Time schedule and am stuck at where I am unable to get the variable to assign to the map, I am getting an error where the key is not assigning. Please see class below
public class BusSchedule { public Time [] schedule1; public String busName; public Map<String, Time[]> schedule2 = new Map<String, Time[]>(); public void putSchedule(String busLine, Time [] schedule){ busName = busLine; schedule2.put(busName, schedule); schedule1 = schedule2.get(busName); } public Time[] getSchedule(String busLine){ Time[] bSched = new Time[]{}; busName = busLine; if (busLine != null && schedule2.containsKey(busName)) { bSched = schedule1; } else { bSched.add(Time.newInstance(11,0,0,0)); bSched.add(Time.newInstance(21,0,0,0)); } return bSched; } }
Regards,
Alain