Here you can find the source of nvl(T mainValue, T... fallbackValues)
Parameter | Description |
---|---|
T | a parameter |
mainValue | a parameter |
fallbackValues | a parameter |
public static <T> T nvl(T mainValue, T... fallbackValues)
//package com.java2s; //License from project: Apache License public class Main { /**/*from www . j a va 2s . c o m*/ * Allows a list of values to be provided, the first non-null value in the * list is returned as the result. * * @param <T> * @param mainValue * @param fallbackValues * @return */ public static <T> T nvl(T mainValue, T... fallbackValues) { T result = mainValue; int idx = 0; while (result == null && idx < fallbackValues.length) { result = fallbackValues[idx++]; } return result; } }