Here you can find the source of isOverlapping(LocalDate firstStartDate, LocalDate firstEndDate, LocalDate secondStartDate, LocalDate secondEndDate)
private static boolean isOverlapping(LocalDate firstStartDate, LocalDate firstEndDate, LocalDate secondStartDate, LocalDate secondEndDate)
//package com.java2s; //License from project: Apache License import java.time.LocalDate; public class Main { private static boolean isOverlapping(LocalDate firstStartDate, LocalDate firstEndDate, LocalDate secondStartDate, LocalDate secondEndDate) { boolean isOverlapping = false; if ((firstStartDate == null && firstEndDate == null) || (secondStartDate == null && secondEndDate == null) || (firstStartDate == null && secondStartDate == null) || (firstEndDate == null && secondEndDate == null)) { isOverlapping = true;//ww w . j a v a2 s . co m } if (firstStartDate != null && secondStartDate == null && secondEndDate != null) { if (firstStartDate.compareTo(secondEndDate) <= 0) { isOverlapping = true; } } if (firstEndDate != null && secondStartDate != null && secondEndDate == null) { if (firstEndDate.compareTo(secondStartDate) >= 0) { isOverlapping = true; } } if (firstStartDate != null && firstEndDate != null && secondStartDate != null && secondEndDate != null) { if (firstStartDate.compareTo(secondStartDate) <= 0 && firstEndDate.compareTo(secondStartDate) >= 0) { isOverlapping = true; } } return isOverlapping; } }