

class PlayerList {


	private Player[] list = null;
	private int nextLocation = 0;
	
	public PlayerList(int initialCapacity) {
		list = new Player[initialCapacity];
	}

	public Player insert(Player player, int index) {
		if (index >= 0 && index < list.length) {
			Player oldElement = list[index];
			list[index] = player;
			return oldElement;
		}
		else {
			return null;
		}
	}

	public Player remove(int index) {
		if (index >= 0 && index < list.length) {
			Player value = list[index];
			list[index] = null;
			return value;
		}
		else {
			return null; 
		}		
	}

	public void printList() {
		for(int i = 0; i < list.length; i++) {
		    if (list[i] != null) {
			    System.out.println(list[i]);
			}
		}
	}

}

