java 为什么 NVL 函数称为“NVL”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28935971/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 14:25:33  来源:igfitidea点击:

Why are NVL functions called "NVL"?

javadatabasenvl

提问by c0rp

Sometimes I see an nvl()function in code. In the case of Java, it looks like this:

有时我会nvl()在代码中看到一个函数。在 Java 的情况下,它看起来像这样:

public static String nvl(String value, String alternateValue) {
    if (value == null)
        return alternateValue;

    return value;
}

I understand what this function does, but I don't understand why it's called nvl. Why not checkNotNullor returnNotNull? What does NVL stand for?

我明白这个函数的作用,但我不明白为什么它被称为nvl. 为什么不checkNotNull或者returnNotNull?NVL 代表什么?

I guess Null Value L...?

我想ñULL VALUE大号...?

采纳答案by Atsby

As others have pointed out in comments, it probably stands for "null value" or "null value logic". It might just as well be called "dflt" (or similar abbreviation) for "default".

正如其他人在评论中指出的那样,它可能代表“空值”或“空值逻辑”。对于“默认”,它也可能被称为“dflt”(或类似的缩写)。

And, in Java, it should really be using generics so that it can work on any type ;)

而且,在 Java 中,它真的应该使用泛型,以便它可以在任何类型上工作;)