本文整理汇总了Java中org.threeten.bp.LocalDate.plusDays方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.plusDays方法的具体用法?Java LocalDate.plusDays怎么用?Java LocalDate.plusDays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.LocalDate
的用法示例。
在下文中一共展示了LocalDate.plusDays方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate_multi
import org.threeten.bp.LocalDate; //导入方法依赖的package包/类
static Map<LocalDate, String> generate_multi(LocalDate start_date, LocalDate end_date, String seed) {
if (start_date.isAfter(end_date)) {
throw new IllegalArgumentException();
}
int days = (int) (1 + ChronoUnit.DAYS.between(start_date, end_date));
// Now let's generate one password for each day
Map<LocalDate, String> password_list = new HashMap<>();
LocalDate date = start_date;
for (int i = 0; i < days; i++) {
password_list.put(date, generate(date, seed));
date = date.plusDays(1);
}
return password_list;
}
示例2: getListOfDaysBetweenTwoDates
import org.threeten.bp.LocalDate; //导入方法依赖的package包/类
/**
* Retrieves a list of days ({@link LocalDate}s) between {@code startDate} and {@code endDate}.
*
* @param startDate the date before the list should start.
* @param endDate the date after the list should end.
* @return the list between, but not including, {@code startDate} and {@code endDate}.
*/
@NonNull
public static List<LocalDate> getListOfDaysBetweenTwoDates(@NonNull LocalDate startDate, @NonNull LocalDate endDate) {
LocalDate endLocalDate = endDate.plusDays(1);
return Stream.iterate(startDate, day -> day.plusDays(1))
.limit(startDate.until(endLocalDate, ChronoUnit.DAYS))
.toList();
}
示例3: remakeLayout
import org.threeten.bp.LocalDate; //导入方法依赖的package包/类
private void remakeLayout() {
if (getWidth() > 0) {
LocalDate day = getRelativeFirstDay(-1);
for (int i = 0; i < layouts.length; i++) {
String dayText = String.valueOf(day.getDayOfMonth());
if (layouts[i] == null) {
layouts[i] = BoringLayout.make(dayText, dayTextPaint, dayWidth,
Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayMetrics, false, ellipsize,
dayWidth);
} else {
layouts[i].replaceOrMake(dayText, dayTextPaint, dayWidth,
Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayMetrics, false, ellipsize,
dayWidth);
}
day = day.plusDays(1);
}
DayOfWeek dayOfWeek = firstDayOfWeek; // first index is 1
for (int i = 0; i < dayLabelLayouts.length; i++) {
CharSequence name;
if (labelNames == null) {
name = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.getDefault());
} else {
int index = dayOfWeek.getValue() - 1;
name = labelNames[index];
}
if (dayLabelLayouts[i] == null) {
dayLabelLayouts[i] = BoringLayout.make(name, dayLabelTextPain, dayWidth,
Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayLabelMetrics, false, ellipsize,
dayWidth);
} else {
dayLabelLayouts[i].replaceOrMake(name, dayLabelTextPain, dayWidth,
Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayLabelMetrics, false, ellipsize,
dayWidth);
}
dayOfWeek = dayOfWeek.plus(1);
}
}
}