Can someone help me point at the difference between these two for loops? They look like they might be doing the same thing, but they aren't.
for(int i = 0; i < shapes.size() - 1; i++) {
Graphics2D g2d = (Graphics2D) g;
shapes.get(i).paint(g2d);
}
How do I write my first for loop without the i (index)?
for(Shape shape : shapes) {
Graphics2D g2d = (Graphics2D) g;
shape.paint(g2d);
}
- 1? as most tutorials would show you the correct way to loop.