Code example for Deque

Methods: addLast, removeFirst

0
    public int getCapacity() { 
        return capacity; 
    } 
 
    public void add(Choice choice) { 
        memory.removeFirst(); 
        memory.addLast(choice); 
    } 
 
    public List<Choice> fetch() { 
        return new ArrayList<Choice>(memory); 
    } 
 
}