Allows the map to be iterable over tiles.

This commit is contained in:
Stian Grenborgen 2024-01-09 19:21:47 +01:00
parent dfbd8b8671
commit 146009a942
1 changed files with 6 additions and 1 deletions

View File

@ -74,7 +74,7 @@ import net.sf.freecol.common.util.LogBuilder;
* In theory, a {@link Game} might contain several Map instances
* connected by the HighSeas.
*/
public class Map extends FreeColGameObject implements Location {
public class Map extends FreeColGameObject implements Location, Iterable<Tile> {
private static final Logger logger = Logger.getLogger(Map.class.getName());
@ -834,6 +834,11 @@ public class Map extends FreeColGameObject implements Location {
return ret;
}
@Override
public Iterator<Tile> iterator() {
return Collections.unmodifiableList(tileList).iterator();
}
/**
* Get a list of all the tiles that match a predicate.
*