code: public boolean contains(long index) {
      assertSegmentOpen();
  
      if (!validIndex(index))
        return false;
  
      // Check the memory index first for performance reasons.
      long offset = relativeOffset(index);
      return offsetIndex.contains(offset);
    }
docs: Returns a boolean value indicating whether the entry at the given index is active.
  
  @param index The index to check.
  @return Indicates whether the entry at the given index is active.
  @throws IllegalStateException if the segment is not open