Skip to content

Instantly share code, notes, and snippets.

@Cristo86 Cristo86/QuickArray.java
Last active Jun 6, 2016

Embed
What would you like to do?
void method() {
// traditional way
Foo.methodThatTakesArrays(new int[]{1,2,3,4,5,6,7,8});
// or..
Foo.methodThatTakesArrays(ai(1,2,3,4,5,6,7,8));
}
/**
* Array of ints
*/
private int[] ai(int...args) {
return args;
}
/**
* Array of objects
*/
private <E> E[] arr(E...args) {
return args;
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.