class CTimeSlot
{
public Time tStart {get; set;}
public Appointment__c sAppointment {get; set;}
public CTimeSlot(Time startTime)
{
tStart = startTime;
Appointment__c = null;
}
}
// ** snip **
list<CTimeSlot> liTimeSlots = new list<CTimeSlot>();
// ** snip ** loop through times, and for each add an entry to the list
CTimeSlot newSlot = new CTimeSlot(loopTime);
liTimeSlots.add(newSlot);
mapTimeToSlot.put(loopTime + '', newSlot);
}
// ** snip ** when running through your query results of Appointment__c objects:
for(Appointment__c sAppointment : [select Id, Time__c from Appointment__c where ...])
{
if(mapTimeToSlot.get(sAppointment.Time__c) != null)
{
mapTimeToSlot.get(sAppointment.Time__c).sAppointment = sAppointment;
}
}
This will consist of class and a list of objects, which will help you to get idea.
I hope this will help.
Want to know more about Salesforce Integration? Watch this video on Salesforce Integration Tutorial | Salesforce Online Training :