In case they’re of wider interest.

  1. Get used to "literal".equals(object). Get used to it. Yes, yes, blah blah blah. Just get to used to it!
  2. Useful classes 101: there’s a generic BidiMap in the Commons-collections library, version 4.0. Hasn’t hit maven2 repo yet, but it’s released (javadocs).
  3. Useful classes 101: org.apache.commons.io.output.NullWriter – writes to dev/null
  4. Boolean unpleasantness. Don’t test myBoolean == true, just use myBoolean. Also remember that this: –

    if(something) {
      return true;
    }
    else {
      return false; 
    }

    is a really long way of saying return something.

  5. No Magic Numbers
  6. Yes, Tuples are lovely. If you really don’t want to design your way around their absence in Java, use something like the generic Pair class.
Advertisements