I have a lot of things to say about this one piece of code. It illustrates so many wonderful things, I can’t even begin to tell you all about them. Part of the reason I can’t go into it is because I’m actually in the middle of teaching a class (we’re working in teams on some problems), and I don’t have time for a full post. The other reason is there are some relatively big ideas here (not new, but relatively big) that I want to spend time on.

So, for future reference:

  int largestValue() {
        Iterator it = ls. iterator();
        int temp = 0
        while (it hasNext()) {
            Integer intTmp =(Integer) it.next:
            int num = intTmp. intValue ();
            if(num >temp); temp = num;{
                return temp;
            }
    }

Ah. It’s sooooo good!

3 Responses to “Useless Java”

  1. Peter Drake says:

    For what it’s worth, this bit of code will be MUCH shorter in Java 1.5, thanks to automatic boxing/unboxing of primitives, generic types, and an enhance for loop.

  2. Matt says:

    I like that it’s pink. But have you considered using a proportional or sans serif font? I think it would be just adorable in a nice Arial Condensed.

  3. Brad says:

    Hold on, let me see if I can do this in Matlab:

    b = max(a)