Java GT、GTE、EQ、LT、LTE 运营商的枚举
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21317399/
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-08-13 08:00:59 来源:igfitidea点击:
enum for GT, GTE, EQ, LT, LTE operators
提问by Marcus Junius Brutus
Is there a Java enum anywhere in the Java libraries for greater-than, greater-than-or-equal, equal, less-than-or-equal, less-thancomparisons?
Java 库中是否有 Java 枚举用于大于、大于或等于、等于、小于或等于、小于比较?
采纳答案by Alan B. Dee
It doesn't appear to be one. Fortunatilly, it's not too difficult to put one together.
它似乎不是一个。幸运的是,将它们放在一起并不太难。
public enum Comparison {
EQ("="), GTE(">="), GT(">"), LT("<"), LTE("<=");
private final String value;
private Comparison(String text) {
this.value = text;
}
public String getValue() {
return this.value;
}
}