tags:

views:

401

answers:

2

I've seen this before in a method parameter, and it appears to allow an arbitrary number of parameters to be stuffed in an array created at run-time. What's the official name of this language feature? Thanks!

    public static void trace(View view, RecyclerTraceType type, int... parameters) {

    RecyclerTrace trace = new RecyclerTrace();
    trace.position = parameters[0];
    trace.indexOnScreen = parameters[1];
}
+9  A: 

You are seeing the Java 1.5 varargs feature. Under the hoods its just an array with syntactic sugaring.

+1  A: 

Variadic Functions

Chad Birch