Java Type Coalesce coalesce(T a, T b)

Here you can find the source of coalesce(T a, T b)

Description

Return the first not null objects in the list of arguments

License

Apache License

Parameter

Parameter Description
a a parameter
b a parameter
T a parameter

Return

object

Declaration

public static <T> T coalesce(T a, T b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from  www .  j av a 2 s . c o  m*/
     * Return the first not null objects in the list of arguments
     * @param a
     * @param b
     * @param <T>
     * @return object
     */
    public static <T> T coalesce(T a, T b) {
        return a == null ? b : a;
    }
}

Related

  1. coalesce(String str1, String str2)
  2. coalesce(String... strings)
  3. coalesce(String... strings)
  4. coalesce(String... vals)
  5. coalesce(String[] values)
  6. coalesce(T o0, T o1)
  7. coalesce(T preferred, T alternative)
  8. coalesce(T value, T whenNullValue)
  9. coalesce(T... args)