title: Given Two lists of date ranges, how to find the non-overlapping dates in java
body: <p>I am not sure if I got the heading correct, but this is what I am trying to achieve.
  Consider the following two classes, AbsentPeriod, UnavailablePeriod.</p>
  
  <pre><code>class AbsentPeriod
  {
      Date startDate;
      Date endDate;
  }
  
  class UnavailablePeriod
  {
      Date startDate;
      Date endDate;
  }
  </code></pre>
  
  <p>Given </p>
  
  <pre><code>Date StartDate // starting point
  Date EndDate //ending point
  List&lt;AbsentPeriod&gt; absentperiods
  List&lt;UnavailablePeriods&gt; unavailablePeriods
  </code></pre>
  
  <p>Find </p>
  
  <pre><code>List&lt;AvailablePeriod&gt; 
  </code></pre>
  
  <p>which has the start and end dates that have dates do not overlap the dates from the Absent and unavailable periods; which are in between given StartDate and endDate</p>
  
  <pre><code>class AvailablePeriod
  {
     Date startDate;
     Date endDate;
  }
  </code></pre>