Is List can not be a return value?
You should return type Array instead. If x is the List you want to return then write x.toArray() at the end of your function.