Is there vararg-like generics in Java?

Calin Baenen - Nov 25 '20 - - Dev Community

Are there generics that can act like varargs in Java?

E.g.

class Test<...T> {
    private final T[0] val = testarg;
    public Test(T[0] testarg) {
        val = testarg;
    }
}
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .