class RotatingQueue<T> extends AbstractQueue<T> {
  /** The array to provide a view of. */
  private final Queue<T> data;

  /** The maximum number of elements that can be present. */
  private final int capacity;

  /**
   * Creates a new {@link RotatingQueue}.
   *
   * @param capacity the maximum number of elements the queue can hold
   * @throws IllegalArgumentException if the capacity is negative
   */
  RotatingQueue(int capacity) {
    checkArgument(capacity >= 0, "capacity must be non-negative but was %d", capacity);
    this.capacity = capacity;
    this.data = new LinkedList<>();
  }

  @Override
  public Iterator<T> iterator() {
    return data.iterator();
  }

  @Override
  public int size() {
    return data.size();
  }

  @Override
  public boolean offer(T element) {<FILL_FUNCTION_BODY>}

  @Override
  public T poll() {
    return data.poll();
  }

  @Override
  public T peek() {
    return data.peek();
  }
}

    if (capacity == 0) return false;
    if (data.size() == capacity) data.remove();
    return data.add(element);
  
<methods>public boolean add(T) ,public boolean addAll(Collection<? extends T>) ,public void clear() ,public T element() ,public T remove() <variables>