public class PileTableau<E> implements Pile<E> {

	protected E[] elements;

	public PileTableau() {
		this.elements = (E[]) new Object[16];
	}

	@Override
	public void addFirst(E element) {
		E[] nouveau = (E[]) new Object[16];
		nouveau[0] = element;
		for (int i = 0; i != this.elements.length-1; i++) {
			nouveau[i+1] = this.elements[i]; 
		}
		this.elements = nouveau;
	}

	@Override
	public E removeFirst() {
		E[] nouveau = (E[]) new Object[16];
		E temp = this.elements[0];
		for (int i = 1; i != this.elements.length; i++) {
			nouveau[i-1] = this.elements[i];
		}
		this.elements = nouveau;
		return temp;
	}

	@Override
	public boolean isEmpty() {
		return (this.elements[0] == null);
	}

}