code: public boolean contains(long index) {
      if (!validIndex(index))
        return false;
  
      Segment segment = segments.segment(index);
      return segment != null && segment.contains(index);
    }
docs: Returns a boolean value indicating whether the log contains a live entry at the given index.
  
  @param index The index to check.
  @return Indicates whether the log contains a live entry at the given index.
  @throws IllegalStateException If the log is not open.