code: @SuppressWarnings("unchecked")
  	public <T> T[] toArray(T[] a) {
  		if (a.length < events.size()) {
  			a = (T[]) java.lang.reflect.Array.newInstance(a.getClass()
  					.getComponentType(), events.size());
  		}
  		for (int i = 0; i < events.size(); i++) {
  			try {
  				a[i] = (T) events.get(i);
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  		}
  		return a;
  	}
docs: /*
  (non-Javadoc)
  
  @see java.util.List#toArray(T[])