org.apache.wicket.util.lang.Objects.compareWithConversion()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.apache.wicket.util.lang.Objects.compareWithConversion()方法的一些代码示例,展示了Objects.compareWithConversion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.compareWithConversion()方法的具体详情如下:
包路径:org.apache.wicket.util.lang.Objects
类名称:Objects
方法名:compareWithConversion

Objects.compareWithConversion介绍

[英]Compares two objects for equality, even if it has to convert one of them to the other type. If both objects are numeric they are converted to the widest type and compared. If one is non-numeric and one is numeric the non-numeric is converted to double and compared to the double numeric value. If both are non-numeric and Comparable and the types are compatible (i.e. v1 is of the same or superclass of v2's type) they are compared with Comparable.compareTo(). If both values are non-numeric and not Comparable or of incompatible classes this will throw and IllegalArgumentException.
[中]比较两个对象是否相等,即使它必须将其中一个对象转换为另一个类型。如果两个对象都是数字,则会将它们转换为最宽的类型并进行比较。如果一个为非数值,一个为数值,则非数值将转换为双精度,并与双精度数值进行比较。如果两者都是非数字且具有可比性,且类型是兼容的(即v1与v2的类型属于同一类或超类),则将其与可比类型进行比较。compareTo()。如果这两个值都是非数字且不可比较的,或者是不兼容的类,则会引发和IllegalArgumentException。

代码示例

代码示例来源:origin: org.apache.wicket/wicket-util

((compareWithConversion(object1, object2) == 0) || object1.equals(object2));

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

((compareWithConversion(object1, object2) == 0) || object1.equals(object2));

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

((compareWithConversion(object1, object2) == 0) || object1.equals(object2));

相关文章