Personally I rarely write loops myself now when I can get away with it... I use the Jakarta commons libs:
Customer findCustomerByid(final int id){
return (Customer) CollectionUtils.find(customers, new Predicate() {
public boolean evaluate(Object arg0) {
return ((Customer) arg0).getId()==id;
}
});
}
Yay! I saved one line!