My attempts at Higher order functions in java:,,

I was using an ArrayList in Hof2 in an attempt to use toArray() and cast it to the generic'd return type. However, you can't create arrays of generics, you can't cast arrays to a sub-type, and the generic'd arraylist's new toArray is public T toArray(T [] t). Suckage!