Dec 05
We all know the Java Collections Framework - Collection, List, Set, Map are used in almost every Java application. We also know that operator overloading in not available in Java, something that has caused a huge debate over the years, especially after C# came out and had it as a feature.
In fact, just today Daniel Pitts posted something about it under his “almost useful” tag. In that, he obviously mentions the convenient square brackets operator map[“key”] or list[1] where map is a Map instance and list is a List instance, of course. Continue reading »
Sep 26
Not that I don’t understand the idea. It’s simple:
final map := new HashMap<String,List<Thing>>();
is equal to
final HashMap<String,List<Thing>> map =
new HashMap<String,List<Thing>>();
And who really wants that kind of line in their code, eh? Why write things twice, anyway?
The proposal in Neal’s blog is considerably sane too, because it offers a way to allow a developer to choose not to use type inference. Some people even offered generic-type inference according to the types passed to the constructor:
Continue reading »
Sep 24
In almost every discussion about the new closures proposal, I see a lot of people comparing closures to delegates, and/or complaining that just because C#/.NET has it, Java doesn’t have to follow. On the latter I will not remark; but regarding a comparison, let’s make a fair comparison between the two (considering, of course, that C#’s delegates feature is already on the market for a couple of years now, and Java’s closures are just a proposal at the moment).
Let’s start with the easy parts:
Continue reading »