/** * Implémentation de l'interface MinimalDeque * * classe à rendre à luc. * * @author Pourchot Adrian * @see Java.util.Deque */ public class SimpleDeque implements MinimalDeque{ private E[] deque; public SimpleDeque(){ this.deque = new E[0]; } public void addFirst(E e){ Objects.requireNonNull(e, "e must not be null"); } public void addLast(E e){ Objects.requireNonNull(e, "e must not be null"); this.deque = this.deque.copyOf(this.deque, this.deque.length+1); this.deque[this.deque.length-1] = e; } public boolean isEmpty(){ if (this.deque.length==0){ return true; } else{ return false; } } public E removeFirst(){ this.deque = this.deque.copyOfRange(this.deque, 1, this.deque.length); } public E removeLast(){ this.deque = this.deque.copyOfRange(this.deque, 0, this.deque.length-1); } }