private CItem( LocalDate date, String summary, Iterable<String> tickets, CChangeType type) { this.date = Objects.requireNonNull(date, "date"); this.summary = Objects.requireNonNull(summary, "summary"); this.tickets = createUnmodifiableList(false, createSafeList(tickets, true, false)); this.type = Objects.requireNonNull(type, "type"); }
private CItem( LocalDate date, String summary, Iterable<String> tickets, CChangeType type) { this.date = Objects.requireNonNull(date, "date"); this.summary = Objects.requireNonNull(summary, "summary"); this.tickets = createUnmodifiableList(false, createSafeList(tickets, true, false)); this.type = Objects.requireNonNull(type, "type"); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(String... elements) { List<String> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(String... elements) { List<String> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of tickets elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(Iterable<String> elements) { if (this.tickets == elements) return this; List<String> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }
/** * Copy the current immutable object with elements that replace the content of {@link CItemType#tickets() tickets}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of tickets elements to set * @return A modified copy of {@code this} object */ public final CItem withTickets(Iterable<String> elements) { if (this.tickets == elements) return this; List<String> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new CItem(this, this.date, this.summary, newValue, this.type); }