Last active
June 6, 2016 19:42
-
-
Save Cristo86/7b68486f45dc5f4ed445e08157662007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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