walkthroughs/week-5-tdd/project/src/main/java/com/google/sps/FindMeetingQuery.java
/**
   * Finds the conflicting time between attendees events and meeting duration.
   *
   * @param events  collection of events happening that day
   * @param request meeting that needs to be scheduled for the attendees
   * @param mandatory determines if the meeting request involves mandatory attendees.
   *
   * @return collection of time when the meeting can not be scheduled.
   */
Finds the conflicting time between attendees events and meeting duration.
@param events  collection of events happening that day
@param request meeting that needs to be scheduled for the attendees
@param mandatory determines if the meeting request involves mandatory attendees.

@return collection of time when the meeting can not be scheduled.
Finds the conflicting time between attendees events and meeting duration . @param events collection of events happening that day @param request meeting that needs to be scheduled for the attendees @param mandatory determines if the meeting request involves mandatory attendees . @return collection of time when the meeting can not be scheduled .
private List<TimeRange> findConflictingTimes(Collection<Event> events, MeetingRequest request, boolean mandatory) {
    List<TimeRange> conflictTimes = new ArrayList<>();
    for (Event event: events) {
      Set<String> attendeesForThisEvent = event.getAttendees();
      if (mandatory) {
        if (!Collections.disjoint(attendeesForThisEvent, request.getAttendees())) {
          conflictTimes.add(event.getWhen());
        }
      } else {
        if (!Collections.disjoint(attendeesForThisEvent, request.getOptionalAttendees())) {
          conflictTimes.add(event.getWhen());
        }
      }
    }
    return conflictTimes;
  }
private List < TimeRange > findConflictingTimes ( Collection < Event > events , MeetingRequest request , boolean mandatory ) { List < TimeRange > conflictTimes = new ArrayList < > ( ) ; for ( Event event : events ) { Set < String > attendeesForThisEvent = event . getAttendees ( ) ; if ( mandatory ) { if ( ! Collections . disjoint ( attendeesForThisEvent , request . getAttendees ( ) ) ) { conflictTimes . add ( event . getWhen ( ) ) ; } } else { if ( ! Collections . disjoint ( attendeesForThisEvent , request . getOptionalAttendees ( ) ) ) { conflictTimes . add ( event . getWhen ( ) ) ; } } } return conflictTimes ; }
Finds the conflicting time between attendees events and meeting duration.
Finds the conflicting time between attendees events and meeting duration .