handling generics, fixing java syntax