### Question:
TimeApi { public static List<LocalDate> getDatesBetweenUsingJava8(LocalDate startDate, LocalDate endDate) { long numOfDaysBetween = ChronoUnit.DAYS.between(startDate, endDate); return IntStream.iterate(0, i -> i + 1) .limit(numOfDaysBetween) .mapToObj(i -> startDate.plusDays(i)) .collect(Collectors.toList()); }  static List<Date> getDatesBetweenUsingJava7(Date startDate, Date endDate); static List<LocalDate> getDatesBetweenUsingJava8(LocalDate startDate, LocalDate endDate); static List<LocalDate> getDatesBetweenUsingJava9(LocalDate startDate, LocalDate endDate);  }### Answer:
@Test public void givenGetDatesBetweenWithUsingJava8_WhenStartEndDate_thenDatesList() { LocalDate startDate = LocalDate.now(); LocalDate endDate = LocalDate.now().plusDays(2); List<LocalDate> dates = TimeApi.getDatesBetweenUsingJava8(startDate, endDate); assertEquals(dates.size(), 2); assertEquals(dates.get(0), LocalDate.now()); assertEquals(dates.get(1), LocalDate.now().plusDays(1)); }