Code example for Deque

Methods: isEmptyaddgetLast

0
  /** 
   * 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. 
   */ 
  public void clear() { 
    plan.clear();
  } 
 
  public int size() { 
    return plan.size();
  } 
Contextual code suggestions in your IDE  Get Codota for Java