DEV Community

Discussion on: Is there vararg-like generics in Java?

zoedreams profile image

nope you can only have one, and it has to be the first one.

you can not use T like an object, it is just a reference to what type you can cast object to,,

T obj = values[pos] // or names[
Enter fullscreen mode Exit fullscreen mode

also you dont need the pos or pos++. i would recommend using a regular for loop with index variables.

what is it your actually trying to do. I am confused with the T[pos]

T is not an object it is the name of object called T.

what is it your actually trying to do?