Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • When comparing objects for equivalence use the method equals() and not the == operator. The only exceptions to this are static final objects that are being used as constants and interned Strings [mandatory].
  • In general labelled break and continue statements should be avoided [recommended]. This is due to the complex flow of control, especially when used with try/finally blocks.
  • Unless some aspect of an algorithm relies on it, then loops count forward [mandatory]. For example:
    for (int j = 0; j < size; j++) {
        // Do something interesting
    }
    
  • Use local variables in loops [recommended]. For example:
    ArrayList clone = (ArrayList) listeners.clone();
    final int size = clone.size();
    for (int j = 0; j < size; j++) {
        System.out.println(clone.elementAt(j));
    }
    
  • Anonymous inner classes should define no instance variables and be limited to three single line methods. Inner classes that declare instance variables or have more complex methods should be named [mandatory].

...