Double Brace Initialization in Java
1–10 of 28 posts
Re: Double Brace Initialization in Java
#2Re: Double Brace Initialization in Java
#3Re: Double Brace Initialization in Java
#4Re: Double Brace Initialization in Java
#5I had known of this before, and I'm fairly certain I've used it before. However, one thing I didn't consider is the equals issue commented on the site. As attractive as it may be to use, I think from now on I will refrain from using the double braces.
I consider myself pretty liberal when it comes to coding standards and being clever, but this is something that will badly piss me off. I can't quite put my finger on why I feel so, considering I am perfectly fine with most of the perl tricks. For example, https://gist.github.com/3392206 looks good to me(you are using Perl, you should know about list and scalar contexts).
Re: Double Brace Initialization in Java
#6This just makes me glad I don't have to write Java any more.
You don't have to do it even if you are writing Java. This is a perfect example of clever for the sake of being clever.
Re: Double Brace Initialization in Java
#7Check out the Immutable Maps feature, does the same with some nice syntactic sugar - http://docs.guava-libraries.googlecode.com/git/javadoc/com/g...
ImmutableSet foos = ImmutableSet.of(a, few, elements);
ImmutableMap map = ImmutableMap.of(k1, v1, k2, v2);Re: Double Brace Initialization in Java
#8I had known of this before, and I'm fairly certain I've used it before. However, one thing I didn't consider is the equals issue commented on the site. As attractive as it may be to use, I think from now on I will refrain from using the double braces.
> I had known of this before, and I'm fairly certain I've used it before. I consider myself pretty liberal when it comes to coding standards and being clever, but this is something that will badly piss me off. I can't quite put my finger on why I feel so, considering I am perfectly fine with most of the perl tricks. For example, https://gist.github.com/3392206 looks good to me(you are using Perl, you should know abou…
Re: Double Brace Initialization in Java
#9This just makes me glad I don't have to write Java any more.
> This just makes me glad I don't have to write Java any more. You don't have to do it even if you are writing Java. This is a perfect example of clever for the sake of being clever.