Java Data Type How to - Adjust LocalDate to next Sunday


We would like to know how to adjust LocalDate to next Sunday.


/* w  ww.j  ava 2  s . c o m*/
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.TemporalAdjusters;

public class Main {
  public static void main(String[] args) {
    LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25

    // next Sunday (2014-03-02)
    LocalDate nextSunday = date.with(;

The code above generates the following result.