suggestion:
((BaseCommand) mCommandList.remove(indexOfCommand)).freeResources();