Here you can find the source of coalesce(T... values)
@Deprecated public static <T> T coalesce(T... values)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww . j av a2 s. c o m*/ * Returns the first non-{@code null} value among the given * {@code values}. * * @deprecated Use {@link #firstNonNull} instead. */ @Deprecated public static <T> T coalesce(T... values) { return firstNonNull(values); } /** * Returns the first non-{@code null} value among the given * {@code values}. * * @param values If {@code null}, returns {@code null}. * @return May be {@code null}. */ public static <T> T firstNonNull(T... values) { if (values != null) { for (T value : values) { if (value != null) { return value; } } } return null; } }