code: @Override
      public boolean offer(final E e) {
          requireNonNull(e, ILLEGAL_ELEMENT);
  
          Supplier<Boolean> offerElement = () -> {
              if (size == 0) {
                  ringBuffer[tailIndex] = e;
                  modificationsCount++;
                  size++;
              } else if (size == maxSize) {
                  headIndex = nextIndex(headIndex);
                  tailIndex = nextIndex(tailIndex);
                  ringBuffer[tailIndex] = e;
                  modificationsCount++;
              } else {
                  tailIndex = nextIndex(tailIndex);
                  ringBuffer[tailIndex] = e;
                  size++;
                  modificationsCount++;
              }
              return true;
          };
          return writeConcurrently(offerElement);
      }
docs: Inserts the specified element at the tail of this queue if it is
  possible to do so immediately or if capacity limit is exited
  the oldest element (the head) will be evicted, and then the new element added at the tail.
  This method is generally preferable to method {@link #add},
  which can fail to insert an element only by throwing an exception.
  
  @throws NullPointerException if the specified element is null