choice = (Entity) this.loadedUnits.remove( 0 );
choice = (Entity) this.loadedUnits.elementAt( 0 ); this.loadedUnits.removeElementAt( 0 );
    private Entity getUnloadedUnit() {        Entity choice = null;        // Handle error condition.        if ( this.loadedUnits.size() == 0 ) {            System.err.println( "MovementDisplay#getUnloadedUnit() called without loaded units." );        }        // If we have multiple choices, display a selection dialog.        else if ( this.loadedUnits.size() > 1 ) {            String[] names = new String[ this.loadedUnits.size() ];            StringBuffer question = new StringBuffer();            question.append( ce().getShortName() );            question.append( " has the following unused space:\n" );            question.append( ce().getUnusedString() );            question.append( "\n\nWhich unit do you want to unload?" );            for ( int loop = 0; loop < names.length; loop++ ) {                names[loop] = ( (Entity)this.loadedUnits.get(loop) ).getShortName();            }            SingleChoiceDialog choiceDialog =                new SingleChoiceDialog( client.frame,                                        "Unload Unit",                                        question.toString(),                                        names );            choiceDialog.show();            if ( choiceDialog.getAnswer() == true ) {                choice = (Entity) this.loadedUnits.get( choiceDialog.getChoice() );            }        } // End have-choices        // Only one choice.        else {            choice = (Entity) this.loadedUnits.remove( 0 );        }        // Return the chosen unit.        return choice;    }