Sorts the events in ascending order.
@param events The events to be sorted.
327662
private void sortEvents(List<? extends WeekViewEvent> events) {
        Collections.sort(events, new Comparator<WeekViewEvent>() {
            @Override
            public int compare(WeekViewEvent event1, WeekViewEvent event2) {
                long start1 = event1.getStartTime().getTimeInMillis();
                long start2 = event2.getStartTime().getTimeInMillis();
                int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
                if (comparator == 0) {
                    long end1 = event1.getEndTime().getTimeInMillis();
                    long end2 = event2.getEndTime().getTimeInMillis();
                    comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0);
                }
                return comparator;
            }
        });
    }
364023
public EventsBatch withEvents(java.util.Map<String, Event> events) {
        setEvents(events);
        return this;
    }
276337
public synchronized void flushEvents()
    {
        while (!this.events.isEmpty()) {
            ComponentEventEntry entry = this.events.pop();
            sendEvent(entry.event, entry.descriptor, entry.componentManager);
        }
    }
287122
public void setEventTypeCodes(java.util.Collection<String> eventTypeCodes) {
        if (eventTypeCodes == null) {
            this.eventTypeCodes = null;
            return;
        }

        this.eventTypeCodes = new java.util.ArrayList<String>(eventTypeCodes);
    }
430127
public void setEventSubscriptionsList(java.util.Collection<EventSubscription> eventSubscriptionsList) {
        if (eventSubscriptionsList == null) {
            this.eventSubscriptionsList = null;
            return;
        }

        this.eventSubscriptionsList = new java.util.ArrayList<EventSubscription>(eventSubscriptionsList);
    }
41644
public function setEvents(array $events)
	{
		if ($events) {
			$this->ensureEvents();
			
			foreach ($events as $name => $handler) {
				$this->on($name, $handler);
			}
		}
	}
441909
public static void sort(double[] keys, int[] values, int start, int end) {
    quickSort(keys, values, start, end);
  }
1284521
public void setSupportedEvents(Collection<Class<? extends ApplicationEvent>> supportedEvents) {
        this.supportedEventsCache.clear();
        if (supportedEvents == null) {
            this.supportedEvents = Collections.emptySet();
        } else {
            this.supportedEvents =
                    new LinkedHashSet<Class<? extends ApplicationEvent>>(supportedEvents);
        }
    }
4845
public void setEventTopics(java.util.Collection<EventTopic> eventTopics) {
        if (eventTopics == null) {
            this.eventTopics = null;
            return;
        }

        this.eventTopics = new com.amazonaws.internal.SdkInternalList<EventTopic>(eventTopics);
    }
454266
public void setMatchingEventTypes(java.util.Collection<String> matchingEventTypes) {
        if (matchingEventTypes == null) {
            this.matchingEventTypes = null;
            return;
        }

        this.matchingEventTypes = new java.util.ArrayList<String>(matchingEventTypes);
    }
339217
public static void selectSort(int[] arrays) {
        for (int i = 0; i < arrays.length; i++) {
            int lowIndex = i;
            for (int j = i + 1; j < arrays.length; j++) {
                if (arrays[j] < arrays[lowIndex]) {
                    lowIndex = j;
                }
            }
            if (lowIndex != i) {
                switchNumber(arrays, i, lowIndex);
            }
        }
    }
759159
public function setEventClasses($events)
    {
        foreach ($events as $iface => $cls) {
            $this->setEventClass($iface, $cls);
        }
    }
703093
public void setEventDestinations(java.util.Collection<EventDestination> eventDestinations) {
        if (eventDestinations == null) {
            this.eventDestinations = null;
            return;
        }

        this.eventDestinations = new java.util.ArrayList<EventDestination>(eventDestinations);
    }
37283
public void sort() {
        if (!sorted) {
            sort(heap, Math.min(k,n));
            sorted = true;
        }
    }
832735
public void sort(@NonNull Comparator<? super T> comparator) {
        final ArrayList<T> copy = new ArrayList<>(mObjects);
        Collections.sort(copy, comparator);
        swap(copy);
    }
1049548
function(events) {
    if (!_.isArray(events)) {
      var errEvtsArrMsg = 'events should be an array!';
      debug(errEvtsArrMsg);
      throw new Error(errEvtsArrMsg);
    }
    var self = this;
    _.each(events, function(evt) {
      self.addEvent(evt);
    });
  }
391293
protected void dispatchEvents() {

    while (true) {

      Object event = this.eventQueue.poll();
      if (event == null) {
        return;
      }
      Collection<Throwable> errors = new LinkedList<>();
      dispatchEvent(event, errors);
      if (!errors.isEmpty()) {
        handleErrors(errors, event);
      }
    }
  }