private TreeMap<LogSegmentName, List<IndexSegment>> getLogSegmentToIndexSegmentMapping(
      ConcurrentSkipListMap<Offset, IndexSegment> indexSegments) {
    TreeMap<LogSegmentName, List<IndexSegment>> mapping = new TreeMap<>();
    for (Map.Entry<Offset, IndexSegment> indexSegmentEntry : indexSegments.entrySet()) {
      IndexSegment indexSegment = indexSegmentEntry.getValue();
      LogSegmentName logSegmentName = indexSegment.getLogSegmentName();
      if (!mapping.containsKey(logSegmentName)) {
        mapping.put(logSegmentName, new ArrayList<IndexSegment>());
      }
      mapping.get(logSegmentName).add(indexSegment);
    }
    return mapping;
  }
@param indexSegments the map of index segment start {@link Offset} to {@link IndexSegment} instances
@return mapping from log segment names to {@link IndexSegment} instances that refer to them.
ambry-store/src/main/java/com/github/ambry/store/PersistentIndex.java