12

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];
}

2 Answers 2

20

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

Sign up to request clarification or add additional context in comments.

Comments

3

Variadic Functions

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.