Two posts today. Just found a geniurrrs way of using varargs.
public static void doThing(String...args) { if (args != null && args.length > 0) doMore(args[0]); if (args != null && args.length > 1) doMore(args[1]); }
It probably used to look like:
public static void doThing(String...args) { for( int i = 0; i < args.length; ++i ){ doMore( args[i] ); if( i = 1 ) break; } }
And then someone decided to optimize this by unrolling the loop.
if( i = 1 )
lolwhat:if( i = 1 )Nice touch.
Nice touch.
This would be a syntax error in Java unfortunately.
Mo6eB: lolwhat:if( i = 1 )Nice touch. This would be a syntax error in Java unfortunately.
See, that's why they unrolled it. It wouldn't compile.
mozbo: Mo6eB: lolwhat:if( i = 1 )Nice touch. This would be a syntax error in Java unfortunately. See, that's why they unrolled it. It wouldn't compile.
darkmattar:what, seriously... it's the original darkmatter? screw him for taking my name and then posting so little! edit: interesting how i joined in 2008 and darkmatter wasn't available until he joined in 2012. screw community server too.