A bit of filtering


for(Iterator i = things.iterator(); i.hasNext(); )
{
  Thing t = (Thing)i.next();

  if(t.age() < 30)
    print(t.name());
}
I mean that's ok, isn't? It's a reasonable thing to do. Anyone prefer I reverse the condition and use a continue? Well, that's ok too.

OK, so we've got a bit of a fussy user, and he says "that's great, but can you just show me these things, these orders, just show me the ones that haven't shipped yet". So we tweak our code a bit more ...