Java Type Coalesce coalesce(String... vals)

Here you can find the source of coalesce(String... vals)

Description

Returns the first non-null value in the arguments.

License

Open Source License

Parameter

Parameter Description

Return

: first non-null.

Declaration

public static String coalesce(String... vals) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*w  ww  .j  a v a2 s  .c om*/
     * Returns the first non-null value in the arguments.
     * @param vals: values to check..
     * @return : first non-null.
     */
    public static String coalesce(String... vals) {
        for (String str : vals) {
            if (str != null)
                return str;
        }

        return null;
    }
}

Related

  1. coalesce(Object... args)
  2. coalesce(Object... items)
  3. coalesce(String str1, String str2)
  4. coalesce(String... strings)
  5. coalesce(String... strings)
  6. coalesce(String[] values)
  7. coalesce(T a, T b)
  8. coalesce(T o0, T o1)
  9. coalesce(T preferred, T alternative)