@FunctionalInterface public interface Copier<T> extends Function1<T,T>
Modifier and Type | Method and Description |
---|---|
default T |
apply(T t)
Apply this as a function.
|
T |
copy(T item)
Get a copy of the given item.
|
static <U> U |
getCopy(Copier<U> copier,
U item)
Get a copy of the given item while taking care of
null values. |
default T |
nullableCopy(T item)
Get a copy of the given item even if it is
null . |
after, andThen, applyNonNull, applyOrDefault, fallback, fallback, from, from, nonFragile, nonFragile, nonFragileX, partial, withFallback
@NotNull T copy(@NotNull T item)
null
,
callers will have to take care of that. See
nullableCopy(Object)
and
getCopy(Copier, Object)
which help in
cases where null
items may appear.item
- item to be copied@Nullable default T nullableCopy(@Nullable T item)
null
.item
- item to be copied, possibly null
null
if item was null
@Nullable static <U> U getCopy(@NotNull Copier<U> copier, @Nullable U item)
null
values.U
- item typecopier
- copier to apply to non-null
itemsitem
- item to be copied, possibly null
null
if item was null