/** * Returns a MetaData instances containing the current entries, <b>and</b> the given {@code key} if it was * not yet present in this MetaData. * If {@code key} already existed, the current value will be used. * Otherwise the Supplier function will provide the {@code value} for {@code key} * * @param key The key for the entry * @param value A Supplier function which provides the value * @return a MetaData instance with an additional entry */ public MetaData andIfNotPresent(String key, Supplier<Object> value) { return containsKey(key) ? this : this.and(key, value.get()); }
/** * Returns a MetaData instances containing the current entries, <b>and</b> the given {@code key} if it was * not yet present in this MetaData. * If {@code key} already existed, the current value will be used. * Otherwise the Supplier function will provide the {@code value} for {@code key} * * @param key The key for the entry * @param value A Supplier function which provides the value * @return a MetaData instance with an additional entry */ public MetaData andIfNotPresent(String key, Supplier<Object> value) { return containsKey(key) ? this : this.and(key, value.get()); }
/** * Returns a MetaData instances containing the current entries, <b>and</b> the given {@code key} if it was * not yet present in this MetaData. * If {@code key} already existed, the current value will be used. * Otherwise the Supplier function will provide the {@code value} for {@code key} * * @param key The key for the entry * @param value A Supplier function which provides the value * @return a MetaData instance with an additional entry */ public MetaData andIfNotPresent(String key, Supplier<Object> value) { return containsKey(key) ? this : this.and(key, value.get()); }