MergedUiDecoration (@NotNull UiDecorator.UiDecoration customDec, @NotNull UiDecorator.UiDecoration defaultDec) { Function<ActionsPosition, Insets> contentInsetsSupplier = position -> { Insets def = Objects.requireNonNull(defaultDec.getContentInsetsSupplier()).apply(position); if (customDec.getContentInsetsSupplier() != null) { return mergeInsets(customDec.getContentInsetsSupplier().apply(position), def); } return def; }; return new MergedUiDecoration( mergeInsets(customDec.getLabelInsets(), Objects.requireNonNull(defaultDec.getLabelInsets())), contentInsetsSupplier, ObjectUtils.notNull(customDec.getIconTextGap(), Objects.requireNonNull(defaultDec.getIconTextGap())) ); }