This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Please, TellTheDetails (i.e. exactly when you are having this exception).
It took me a little type to figure this out that the exception occurs when you actually try to assign output of subset method to an array
As amit has suggested, either you should provide class type of T to the method (which will return the array of type T, instead of array of Object), or, you have to get the returned value in an Object array, and later-on you can cast it to real type T.