private boolean hasOverlap(ArrayList<Interval> intervals) {

    for (Interval interval : intervals) {
      for (Interval interval2 : intervals) {
        if (interval != interval2 && isOverlap(interval, interval2)) {
          return true;
        }
      }
    }
    return false;
  }