Comparing the values of two generic Numbers

后端 未结 12 1799
小鲜肉
小鲜肉 2020-11-27 04:48

I want to compare to variables, both of type T extends Number. Now I want to know which of the two variables is greater than the other or equal. Unfortunately I

12条回答
  •  醉酒成梦
    2020-11-27 05:31

    You can simply use Number's doubleValue() method to compare them; however you may find the results are not accurate enough for your needs.

提交回复
热议问题