code: public long lastIndex() {
      assertSegmentOpen();
      return !isEmpty() ? offsetIndex.lastOffset() + descriptor.index() + skip : descriptor.index() - 1;
    }
docs: Returns the index of the last entry in the segment.
  
  @return The index of the last entry in the segment or {@code 0} if the segment is empty.
  @throws IllegalStateException if the segment is not open