| 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> |