@@ -229,55 +229,56 @@ public static boolean anyNotNull(final Object... values) {
229229
230230 /**
231231 * <p>
232- * Invokes the given {@code consumer's} {@link Consumer#accept(Object)} with the first {@code non-null} value from
233- * {@code objects}. If all the values are null, the consumer is not invoked.
232+ * Calls the given {@code consumer's} {@link Consumer#accept(Object)} method with the first {@code non-null} value
233+ * from {@code objects}. If all the values are null, the consumer is not invoked. This is equivalent to the call
234+ * {@code ObjectUtils.acceptIfNonNull(ObjectUtils.firstNonNull(objects), consumer)}
234235 * </p>
235236 *
236237 * <p>
237238 * The caller is responsible for thread-safety and exception handling of consumer.
238239 * </p>
239240 *
240241 * <pre>
241- * ObjectUtils.applyFirstNonNull (bean::setValue, null) - setValue not invoked
242- * ObjectUtils.applyFirstNonNull (bean::setValue, null, "abc", "def") - setValue invoked with "abc"
243- * ObjectUtils.applyFirstNonNull (v -> bean.setValue(v), "abc") - setValue invoked with "abc"
242+ * ObjectUtils.acceptFirstNonNull (bean::setValue, null) - setValue not invoked
243+ * ObjectUtils.acceptFirstNonNull (bean::setValue, null, "abc", "def") - setValue invoked with "abc"
244+ * ObjectUtils.acceptFirstNonNull (v -> bean.setValue(v), "abc") - setValue invoked with "abc"
244245 * </pre>
245246 *
246247 * @param <T> the type of the object
247248 * @param objects the values to test, may be {@code null} or empty
248249 * @param consumer the consumer operation to invoke with the first non-null {@code objects}.
249250 * @see #firstNonNull(Object...)
250- * @see #applyIfNonNull(Consumer, Object )
251+ * @see #acceptIfNonNull(Object, Consumer )
251252 * @since 3.12
252253 */
253254 @ SafeVarargs
254- public static <T > void applyFirstNonNull (final Consumer <T > consumer , final T ... objects ) {
255- applyIfNonNull ( consumer , firstNonNull (objects ));
255+ public static <T > void acceptFirstNonNull (final Consumer <T > consumer , final T ... objects ) {
256+ acceptIfNonNull ( firstNonNull (objects ), consumer );
256257 }
257258
258259 /**
259260 * <p>
260- * Invokes the given {@code consumer's} {@link Consumer#accept(Object)} with the {@code object} if it is
261- * {@code non-null}, otherwise the consumer is not invoked .
261+ * Calls the given {@code consumer's} {@link Consumer#accept(Object)} method with the {@code object} if it is
262+ * {@code non-null}.
262263 * </p>
263264 *
264265 * <p>
265266 * The caller is responsible for thread-safety and exception handling of consumer.
266267 * </p>
267268 *
268269 * <pre>
269- * ObjectUtils.applyIfNonNull( bean::setValue, null ) - setValue not invoked
270- * ObjectUtils.applyIfNonNull( bean::setValue, "abc" ) - setValue invoked with "abc"
271- * ObjectUtils.applyIfNonNull( v -> bean.setValue(v), "abc" ) - setValue invoked with "abc"
270+ * ObjectUtils.acceptIfNonNull(null, bean::setValue) - setValue not invoked
271+ * ObjectUtils.acceptIfNonNull("abc", bean::setValue) - setValue invoked with "abc"
272+ * ObjectUtils.acceptIfNonNull("abc", v -> bean.setValue(v)) - setValue invoked with "abc"
272273 * </pre>
273274 *
274275 * @param <T> the type of the object
275276 * @param object the {@code Object} to test, may be {@code null}
276277 * @param consumer the consumer operation to invoke with {@code object} if it is {@code non-null}
277- * @see #applyFirstNonNull (Consumer, Object...)
278+ * @see #acceptFirstNonNull (Consumer, Object...)
278279 * @since 3.12
279280 */
280- public static <T > void applyIfNonNull (final Consumer < T > consumer , final T object ) {
281+ public static <T > void acceptIfNonNull (final T object , final Consumer < T > consumer ) {
281282 if (object != null ) {
282283 consumer .accept (object );
283284 }
0 commit comments