Code example for Deque

Methods: add

0
 
  /** 
   * Plans the next action. 
   */ 
  public void plan(T action) {
    plan.add(action);
  } 
 
  /** 
   * plans the next action, checks if the last action added is equal. If so it 
   * will not add it, else it will add it at the end of the plan. 
   */ 
  public void planDistinct(T action) {
    if (plan.isEmpty() || !plan.getLast().equals(action)) {
      plan.add(action);
    } 
  } 
 
  /** 
   * Throws the plan into the trash bin. 
   */