考虑下面的示例,inputList 具有重叠的日期范围
List<DateRange> inputList = new ArrayList<>();
inputList.add(new DateRange(LocalDate.of(2023, 7, 01), LocalDate.of(2023, 7, 10) ));
inputList.add(new DateRange(LocalDate.of(2023, 7, 05), LocalDate.of(2023, 7, 15) ));
inputList.add(new DateRange(LocalDate.of(2023, 7, 10), LocalDate.of(2023, 7, 20) ));
inputList.add(new DateRange(LocalDate.of(2023, 8, 01), LocalDate.of(2023, 8, 20) ));
需要合并所有重叠时段,并在resultList中保留剩余的非重叠时段
List<DateRange> resultList = new ArrayList<>();
resultList.add(new DateRange(LocalDate.of(2023, 7, 01), LocalDate.of(2023, 7, 04)));
resultList.add(new DateRange(LocalDate.of(2023, 7, 05), LocalDate.of(2023, 7, 09))); overlap
resultList.add(new DateRange(LocalDate.of(2023, 7, 10), LocalDate.of(2023, 7, 10)));overlap
resultList.add(new DateRange(LocalDate.of(2023, 7, 11), LocalDate.of(2023, 7, 15)));
resultList.add(new DateRange(LocalDate.of(2023, 7, 16), LocalDate.of(2023, 7, 20)));overlap
resultList.add(new DateRange(LocalDate.of(2023, 8, 01), LocalDate.of(2023, 8, 20) )