Monday, February 11, 2008

My own Java puzzles

Programming in Java for some time now (about six and a half years) I started discovering myself some Java puzzles. They first appeared as bugs in my code or in some colleague's code and investigating them lead me to discover some unexpected behavior in the core Java API. The two examples I found are the equals and compareTo methods in java.sql.Timestamp and the behavior of HashSet when holding mutable objects. Of course these issues are documented in the Sun's Java API docs(see the notes regarding java.sql.Timestamp and java.util.Set in the Javadocs), but I bet most of the people discover them the hard way :)
Post a Comment