Update syntax to use Java generics and enforce type safety