common/src/main/java/com/streamsets/pipeline/lib/queue/XEvictingQueue.java
public E addAndGetEvicted(E e) {
    checkNotNull(e);  // check before removing
    if (maxSize == 0) {
      return null;
    }
    E evicted = null;
    if (size() == maxSize) {
      evicted = delegate.remove();
    }
    delegate.add(e);
    return evicted;
  }
public E addAndGetEvicted(E e) {
    checkNotNull(e);  // check before removing
    if (maxSize == 0) {
      return null;
    }
    E evicted = null;
    if (size() == maxSize) {
      evicted = delegate.remove();
    }
    delegate.add(e);
    return evicted;
  }
Adds the given element to this queue. If the queue is currently full, the element at the head
of the queue is evicted to make room and returns the evicted element.

@return the evicted element, <code>NULL</code> if none.