code: public static Collection<TimeSlot> calculateAvailableSots(Collection<TimeInterval> takenTimeSlots, Date date, int intervalSeconds,Time startTime, Time endTime)
     {
        Day day = new Day(date);
        
        Collection<TimeSlot> allTimeSlots = calculateTimeSots(day,intervalSeconds,startTime, endTime);
        
        if(takenTimeSlots == null || takenTimeSlots.isEmpty())
           return allTimeSlots;
        
        TimeSlot timeSlot = null;
        TreeSet<TimeSlot> availableSlots = new TreeSet<TimeSlot>();
        for (Iterator<TimeSlot> i = allTimeSlots.iterator(); i.hasNext();)
        {
           timeSlot =  i.next();
           
           if(!takenTimeSlots.contains(timeSlot))
           {
              availableSlots.add(timeSlot);
           }         
        }
        return availableSlots;
     }
docs: --------------------------------------------