java sucks!
No not really, it's just that the the current code assignment, which really sucks, is in java.
Too angry, must take a break and go to my fathers birthday.
elaboration
Side-effects aren't cool, calling a method just to get a side-effect, is something i loath to do. We had to code a simple queue whose content is limited by the types the comparator accepts. The comparator will throw a exception if incompatible objects are passed. So the queue.enqueu(Object o)
method will “throw” will throw it aswell, which is okay if the queue already contains an element. If the queue is empty no comparison/sorting has to be done, but that means you could have a object, which won't be accepted by the comparator, in your queue. Calling comparator.compare(o,o)
solves the problem, but I don't want to compare anything I call it just to cause a exception if o
isn't accepted by comparator.compare()
. Thats why “java” sucks.
No comments:
Post a Comment