Package net.sf.freecol.common.model
Class UnitIterator
- java.lang.Object
-
- net.sf.freecol.common.model.UnitIterator
-
-
Constructor Summary
Constructors Constructor Description UnitIterator(Player owner, java.util.function.Predicate<Unit> predicate)Creates a newUnitIterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Unitnext()voidremove()booleanremove(Unit u)Removes a specific unit from this unit iterator.voidreset()Reset the iterator.booleansetNext(Unit unit)Set the next valid unit.private voidupdate()Update the internal units list with units that satisfy the predicate.
-
-
-
Method Detail
-
update
private final void update()
Update the internal units list with units that satisfy the predicate.
-
setNext
public boolean setNext(Unit unit)
Set the next valid unit.- Parameters:
unit- TheUnitto put at the front of the list.- Returns:
- True if the operation succeeds.
-
remove
public boolean remove(Unit u)
Removes a specific unit from this unit iterator.- Parameters:
u- TheUnitto remove.- Returns:
- True if the unit was removed.
-
reset
public void reset()
Reset the iterator.
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<Unit>
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<Unit>
-
-