code: @SuppressWarnings("unchecked")
  	@Pure
  	public <T extends EventListener> T[] getListeners(Class<T> type) {
  		final Object[] l = this.listeners;
  		final int n = getListenerCount(l, type);
  		final T[] result = (T[]) Array.newInstance(type, n);
  		int j = 0;
  		for (int i = l.length - 2; i >= 0; i -= 2) {
  			if (l[i] == type) {
  				result[j++] = type.cast(l[i + 1]);
  			}
  		}
  		return result;
  	}
docs: Return an array of all the listeners of the given type.
  
  @param <T> is the type of expected listeners.
  @param type is the type of expected listeners.
  @return all of the listeners of the specified type.
  @throws ClassCastException if the supplied class is not assignable to EventListener