Beautiful casting gone bad

Recently I encountered a blog entry describing a “beautiful” way of making the code more readable by creating a gereric helper method to perform object casting. Today I want to share some opinions about this improvement and general thoughts about coding.
The premise
In essence author of this post was trying to solve following problem: imagine you [...]

Type safety in Java Set and Map

Probably many of you still remember the lack of type checking in Java 1.4 Collections and how much hassle it was to deal with casting the collection elements, not to mention how many errors this introduced to the code. Since introduction of generics in Java 1.5 this have really improved and one might think that [...]