Java Object NVL nvl(E expr1, E expr2)

Here you can find the source of nvl(E expr1, E expr2)

Description

Nvl function.

License

Open Source License

Parameter

Parameter Description
expr1 a parameter
expr2 a parameter

Return

return (null != expr1) ? expr1 : expr2;

Declaration

public static <E> E nvl(E expr1, E expr2) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w w w . j  ava  2  s  .  com
     * Nvl function. Same as in Oracle SQL. NVL lets you replace null (returned
     * as a blank) with a string in the results of a query. If expr1 is null,
     * then NVL returns expr2. If expr1 is not null, then NVL returns expr1.
     *
     * @param expr1
     * @param expr2
     *
     * @return return (null != expr1) ? expr1 : expr2;
     */
    public static <E> E nvl(E expr1, E expr2) {
        return (null != expr1) ? expr1 : expr2;
    }
}

Related

  1. isNullOrEmpty(final Object obj)
  2. isNullOrEmpty(Object object, boolean zeroEqualsEmpty)
  3. isNullOrEmptyOrZero(Object object)
  4. nvl(Boolean b, boolean defaultValue)
  5. nvl(CharSequence source)
  6. nvl(final T t, final T def)
  7. nvl(Integer value, Number valueWhenNull)
  8. NVL(Long l)
  9. nvl(Object a, Object b, Object c)