Wednesday, 29. April 2009, 16:36:15
Sorting, Collection, Number, Java
Recently I needed to sort a collection of Number objects (i.e Integers, Doubles, Longs, etc.) in a clean and concise manner somewhere deep within the code-base of the project component of my thesis. Here, by "clean and concise", I mean without lots of ugly castings, ifs, switches, etc.
At first I thought that the Number class implements the Comparable interface in a way that makes it possible to sort a collection of heterogenous Number objects. To my surprise, it turned out that the Number class does not implement the Comparable and instead, implementing Comparable is delegated to its subclasses. So an Integer is only comparable to an Integer, a Double to a Double, and so on.
It turns out that this is not a new problem and it has hit a lot of other programmers as well. In short, there's not a concise and clean solution to this problem. I searched through the Web and I came up with these two links among others that discuss this very problem and I thought it worths to share it here:
If you have any thoughts, ideas, or solutions please care to write about them in the comments.
Monday, 20. April 2009, 14:08:51
Trance, Music
Friday, 3. April 2009, 06:46:34
JavaFX, OS X, Java
I haven't looked at JavaFX thoroughly yet, but in JavaFX we can't declare multi-dimensional arrays. This is absolutely retarded. Just had to write this to get rid of all this JavaFX anger inside me.
No matter how hard I try to convince myself to use it to create cool-effect-fueled desktop apps or RIAs I just can't do it. JavaFX Script is ugly, ugly, and ugly.
And thanks, Sun, for simply ignoring and not including a table component in your "production-ready" marketing-ware RIA platform.
I have no idea what's going on "inside" Sun, but when at a very crucial step of the development cycle of JavaFX, two key members (Chet Haase and Hans Muller) and other influential minds behind JavaFX like Rich Green leave the team, nothing but a crappy and lacking product can be expected.
Oh, and thank you Apple for not moving your ass and updating your Java 6 implementation to 6uN to make all these demo-ware JavaFX apps run as sluggish as possible on OS X. Yeah, I know. We have to wait for Snow Leopard to see 6uN on OS X.
Showing posts 1 -
3 of 93.