Iterating through LocalDate range groovy list

67 Views Asked by At

This used to work under Groovy 3.x version but fails in 4.x

    LocalDate startDate = LocalDate.of(2023, Month.JULY, 1)
    LocalDate endDate = LocalDate.of(2023, Month.JULY, 31)
    LocalDate[] businessDates = (startDate..endDate).collect()
    businessDates.stream().forEach { print it }
Caught: groovy.lang.MissingMethodException: 
No signature of method: java.time.LocalDate.next() is applicable for argument types: () values: []
Possible solutions: get(java.time.temporal.TemporalField), wait(), now(), wait(long), now(java.time.Clock), now(java.time.ZoneId)
groovy.lang.MissingMethodException: 
No signature of method: java.time.LocalDate.next() is applicable for argument types: () values: []
Possible solutions: get(java.time.temporal.TemporalField), wait(), now(), wait(long), now(java.time.Clock), now(java.time.ZoneId)
    at Main.run(Main.groovy:4)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Any ideas on how to fix this?

0

There are 0 best solutions below