ClustrMaps

The roadrunner is back as never before! See also: My homepage or my very obsolete site
If by any means entries in my blog are considered to be harmful or damaging, please let me know (add comment) or just mail me. In this (unhopely) case I will remove or change the contents.

Wednesday, October 24, 2007

Java Annoyances

Not only Windows knows its annoyances, also (or even Java) has a collection of those guys:
http://www.whysmalltalk.com/articles/weddle/annoyances.htm

To my humble opinion this list is far from complete.
The switch case statement is at least confusing, but certainly error-prone if by accident a break stament is missing in action.
And those bloody primitives!!!
And so on ...

And String is a pain in the ass.
See for instance this discussion about trimRight that is not a method of String: http://forum.java.sun.com/thread.jspa?threadID=465541&messageID=2140064

And the final solution:
public String trimRight(String input) {
  return input.split("\\ *\\z")[0];
}
String itself should have trimRight and trimLeft.

Feel free to add your annoyances to the list by means of your comment to this blog entry.

No comments:

Blog Archive