docs: synchronized JournalSegment<E> getSegment(long index) {
      assertOpen();
      // Check if the current segment contains the given index first in order to prevent an unnecessary map lookup.
      if (currentSegment != null && index > currentSegment.index()) {
        return currentSegment;
      }
  
      // If the index is in another segment, get the entry with the next lowest first index.
      Map.Entry<Long, JournalSegment<E>> segment = segments.floorEntry(index);
      if (segment != null) {
        return segment.getValue();
      }
      return getFirstSegment();
    }