code: public final Period add(final Period period) {
          DateTime newPeriodStart;
          DateTime newPeriodEnd;
  
          if (period == null) {
              newPeriodStart = getStart();
              newPeriodEnd = getEnd();
          }
          else {
              if (getStart().before(period.getStart())) {
                  newPeriodStart = getStart();
              }
              else {
                  newPeriodStart = period.getStart();
              }
              if (getEnd().after(period.getEnd())) {
                  newPeriodEnd = getEnd();
              }
              else {
                  newPeriodEnd = period.getEnd();
              }
          }
  
          return new Period(newPeriodStart, newPeriodEnd);
      }
docs: Creates a period that encompasses both this period and another one. If
  the other period is null, return a copy of this period. NOTE: Resulting
  periods are specified by explicitly setting a start date and end date
  (i.e. durations are implied).
  
  @param period
  the period to add to this one
  @return a period