code: public long add(Object item) {
          tailSequence++;
  
          if (tailSequence - items.length == headSequence) {
              headSequence++;
          }
  
          int index = toIndex(tailSequence);
  
          items[index] = item;
  
          return tailSequence;
      }
docs: Adds an item to the tail of the ringbuffer. If there is no space in the
  ringbuffer, the add will overwrite the oldest item in the ringbuffer.
  The method allows null values.
  <p>
  The returned value is the sequence of the added item. Using this sequence
  you can read the added item.
  <h3>Using the sequence as ID</h3>
  This sequence will always be unique for this ringbuffer instance so it
  can be used as a unique ID generator if you are publishing items on this
  ringbuffer. However you need to take care of correctly determining an
  initial ID when any node uses the ringbuffer for the first time. The most
  reliable way to do that is to write a dummy item into the ringbuffer and
  use the returned sequence as initial ID. On the reading side, this dummy
  item should be discard. Please keep in mind that this ID is not the
  sequence of the item you are about to publish but from a previously
  published item. So it can't be used to find that item.
  
  @param item the item to add
  @return the sequence of the added item