I have a class called Tile that has the follow methods:
public Tile(Shape tile, Color color, int position), getTile(),
setTile(), getColor(), setColor(), getPosition(), setPosition()
Now using for(Tile item: tiles) I want to have a item.Next() that will move to the next index.
Btw tiles is List<Tile> tiles = new ArrayList<Tile> contains all the tiles, color and position.
So my question is how do I implement Next() in the Tile class? I can't do item++ since its of type Tile, etc.
Thanks for the help.
Note my Tile class and ArrayList tiles is located in different files
tilesinclude all the tiles if it isList<String> tiles = new ArrayList<String>(). Shouldn't it beList<Tile> tiles = new ArrayList<Tile>();? If you change tiles to be that you can simple do for(Tile tile: files) { tile.setColor(color); } or whatever you have to do.