Code example for ListIterator

Methods: hasNextnextset

0
public class Password implements IRaceOption 
{ 
	@Override 
	public void exec( Race race, ListIterator<String> cmd, PrintWriter out )
	{ 
		if( !cmd.hasNext() )
		{ 
			out.println( "Current password is " + race.getPassword() );
			return; 
		} 
 
		String pass = race.getGalaxy().validIdentifier( cmd.next() );
		cmd.set( "???" );
		race.setPassword( pass );
		OGSserver.playerLog( null, race, "Password changed to {0}", pass );
		race.log( "Player's password changed" );
	} 
}