My Life and Times

14 July 2006

that Khan moment

Filed under: Uncategorized — 2pacfan187 @ 11:05 pm

remember when that guy from Wrath of Khan screams out “KHAN!!!” ? Man I hate rules for punctuation. It doesn’t really make sense to put them within quotes, but that’s the rules. With exceptions. Watev, on with my story.

In Java 1.5, you can set the type for your collections, so I could do
ArrayList<Bug> buglist
To retrieve a Bug, I would just go
Bug b = buglist.get(1)
It’s super clean right?

In Java 1.4, you can’t do that type-setting. All collections are generic, in that they don’t like you and don’t store type information when you put something in them. So for the same thing, I would go
ArrayList buglist
To get a Bug out though, I have to do
Bug b = (Bug) buglist.get(1)
That (Bug) is called a cast.

So what?, you say, that’s one little extra bit of text. Well, when you are writing really expressive lines of code, and you suddenly have to pull something out of a list, and then you have to cast a generic object into a, oh, say, DefaultTextMessageGUIAdapterListener, your line will double in length, and really piss you off that you have to work in 1.4 and put up with that shit. Whenever this happens when I code, I just think in my head, “KHAAAAN!” I mean, “JAVA 1.4OOUUR!” Because 1.4 is a devious beast.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: