Code example for ListIterator

Methods: hasNext, next

0
public class DeleteGame extends AbstractServerCommand 
{ 
	@Override 
	public boolean exec( Session session, Answer answer, ListIterator<String> cmd, String[] text ) throws GalaxyException
	{ 
		if( !cmd.hasNext() )
			throw new GalaxyException( "Required game name" ); 
 
		String gameName = cmd.next();
 
		// delete game 
		File gameDir = new File( "games" + File.separator + gameName );
		if( !gameDir.exists() )
			throw new GalaxyException( "Unknown game {0}", gameName );
 
		//delete subdirs & files 
		if( !Utils.deleteDir( gameDir ) )
			throw new GalaxyException( "Can't delete directory {0}", gameDir.toString() );
 
		// delete info 
		String infoName = "info" + File.separator + gameName;