MCPcopy Create free account
hub / github.com/MenoData/Time4J / ofCalendarUnits

Method ofCalendarUnits

base/src/main/java/net/time4j/Duration.java:497–519  ·  view source on GitHub ↗
(
        int years,
        int months,
        int days
    )

Source from the content-addressed store, hash-verified

495 * @see #inverse()
496 */
497 public static Duration<CalendarUnit> ofCalendarUnits(
498 int years,
499 int months,
500 int days
501 ) {
502
503 List<Item<CalendarUnit>> items = new ArrayList<>(3);
504
505 if (years != 0) {
506 items.add(Item.of(years, YEARS));
507 }
508
509 if (months != 0) {
510 items.add(Item.of(months, MONTHS));
511 }
512
513 if (days != 0) {
514 items.add(Item.of(days, DAYS));
515 }
516
517 return new Duration<>(items, false);
518
519 }
520
521 /**
522 * <p>Creates a positive duratioon in hours, minutes and seconds. </p>

Calls 2

ofMethod · 0.95
addMethod · 0.45