question: public < E extends GenericEvent > Event waitFor ( @ NonNull List < Class < ? extends E > > eventClasses , long timeout , @ NonNull TimeUnit unit ) throws InterruptedException { while ( true ) { Event curEvent = eventQueue . poll ( timeout , unit ) ; if ( curEvent == null ) return null ; for ( Class < ? extends GenericEvent > curEventClass : eventClasses ) if ( curEventClass . isInstance ( curEvent ) ) return curEvent ; } }
target:  Wait for events of the specified event class to appear in the queue. If the event was dispatched before this is called, it will return immediately. Events that do not match the specified event class are discarded