code: public List<DateTimePeriod> toPeriods(DateTimeDuration duration) {
          if (duration == DateTimeDuration.YEAR) {
              return toYears();
          } else if (duration == DateTimeDuration.MONTH) {
              return toMonths();
          } else if (duration == DateTimeDuration.DAY) {
              return toDays();
          } else if (duration == DateTimeDuration.HOUR) {
              return toHours();
          } else if (duration == DateTimeDuration.FIVE_MINUTES) {
              return toFiveMinutes();
          } else {
              throw new UnsupportedOperationException("Duration " + duration + " not supported yet");
          }
      }
docs: Converts this period to a list of periods for the given duration.  This is
  an alternative way to create a list of periods instead of calling each
  specific duration method such as toHours() or toDays(). Partial periods will not be
  included.
  @return A list of periods contained within this period for the specified duration
  @see #toFiveMinutes()
  @see #toHours()
  @see #toDays()
  @see #toMonths()
  @see #toYears()