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 boolean
hasNext()
Unit
next()
void
remove()
boolean
remove(Unit u)
Removes a specific unit from this unit iterator.void
reset()
Reset the iterator.boolean
setNext(Unit unit)
Set the next valid unit.private void
update()
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
- TheUnit
to 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
- TheUnit
to remove.- Returns:
- True if the unit was removed.
-
reset
public void reset()
Reset the iterator.
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<Unit>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<Unit>
-
-