Added generics, changed iteration
More java5