Came across this nice problem today: The java.util.Calendar class provides a method "before(Object)" which is supposed to tell you if the calendar calling that method is before the given object. BUT, as stated in the javadocs it only works if the passed object is a calendar itself. If its a java.util.Date object, then forget it, the method just returns false, even though you would expect the calendar to be able to compare its date with a Date object. I can't quite figure out how come they don't just require a Calendar instead of an object. There is nothing in the code to give the reason. So, I just don't get it. But it's been like that for three years now, so I guess we just need to get used to it :-(
Read more