本文整理了Java中java.lang.Float.equals()
方法的一些代码示例,展示了Float.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.equals()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:equals
[英]Tests this double for equality with object. To be equal, object must be an instance of Float and floatToIntBits must give the same value for both objects.
Note that, unlike ==, -0.0 and +0.0 compare unequal, and NaNs compare equal by this method.
[中]测试此double是否与object相等。若要相等,对象必须是Float的实例,并且floatToIntBits必须为这两个对象提供相同的值。
请注意,与==、-0.0和+0.0不同,使用此方法比较不相等,而NaN比较相等。
代码示例来源:origin: alibaba/druid
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
OracleBinaryFloatExpr other = (OracleBinaryFloatExpr) obj;
if (value == null) {
if (other.value != null) {
return false;
}
} else if (!value.equals(other.value)) {
return false;
}
return true;
}
代码示例来源:origin: alibaba/druid
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
SQLRealExpr other = (SQLRealExpr) obj;
if (value == null) {
if (other.value != null) {
return false;
}
} else if (!value.equals(other.value)) {
return false;
}
return true;
}
代码示例来源:origin: apache/geode
public void incFloat(String attributeName, Float newVal, Float oldVal) {
if (newVal.equals(oldVal)) {
return;
}
AtomicReference<Number> ar = aggregateMap.get(attributeName);
for (;;) {
Number expectedVal = ar.get();
Number curVal = expectedVal.floatValue() + (newVal - oldVal);
if (ar.compareAndSet(expectedVal, curVal)) {
return;
}
}
}
代码示例来源:origin: ehcache/ehcache3
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Float object, ByteBuffer binary) {
return object.equals(read(binary));
}
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setRawTextSize(float textSize) {
if (this.rawTextSize.equals(textSize)) {
return;
}
this.rawTextSize = textSize;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setInsetPaddingBottom(float insetPaddingBottom) {
if (this.insetPaddingBottom.equals(insetPaddingBottom)) {
return;
}
this.insetPaddingBottom = insetPaddingBottom;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setWordSpacingMultiplier(float wordSpacingMultiplier) {
if (this.wordSpacingMultiplier.equals(wordSpacingMultiplier)) {
return;
}
this.wordSpacingMultiplier = wordSpacingMultiplier;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setInsetPaddingRight(float insetPaddingRight) {
if (this.insetPaddingRight.equals(insetPaddingRight)) {
return;
}
this.insetPaddingRight = insetPaddingRight;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setInsetPaddingLeft(float insetPaddingLeft) {
if (this.insetPaddingLeft.equals(insetPaddingLeft)) {
return;
}
this.insetPaddingLeft = insetPaddingLeft;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setInsetPaddingTop(float insetPaddingTop) {
if (this.insetPaddingTop.equals(insetPaddingTop)) {
return;
}
this.insetPaddingTop = insetPaddingTop;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setLineHeightMultiplier(float lineHeightMultiplier) {
if (this.lineHeightMultiplier.equals(lineHeightMultiplier)) {
return;
}
this.lineHeightMultiplier = lineHeightMultiplier;
invalidate();
}
代码示例来源:origin: bluejamesbond/TextJustify-Android
public void setParentWidth(float parentWidth) {
if (this.parentWidth.equals(parentWidth)) {
return;
}
this.parentWidth = parentWidth;
invalidate();
}
代码示例来源:origin: aws/aws-sdk-java
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ImageQuality == false)
return false;
ImageQuality other = (ImageQuality) obj;
if (other.getBrightness() == null ^ this.getBrightness() == null)
return false;
if (other.getBrightness() != null && other.getBrightness().equals(this.getBrightness()) == false)
return false;
if (other.getSharpness() == null ^ this.getSharpness() == null)
return false;
if (other.getSharpness() != null && other.getSharpness().equals(this.getSharpness()) == false)
return false;
return true;
}
代码示例来源:origin: spring-projects/spring-framework
assertTrue("Correct bigInteger value", new BigInteger("3").equals(accessor.getPropertyValue("bigInteger")));
assertTrue("Correct bigInteger value", new BigInteger("3").equals(target.getBigInteger()));
assertTrue("Correct float2 value", new Float("8.1").equals(accessor.getPropertyValue("float2")));
assertTrue("Correct float2 value", new Float("8.1").equals(target.getFloat2()));
assertTrue("Correct double2 value", new Double("6.1").equals(accessor.getPropertyValue("double2")));
assertTrue("Correct double2 value", new Double("6.1").equals(target.getDouble2()));
代码示例来源:origin: spring-projects/spring-framework
assertTrue("Correct bigInteger value", new BigInteger("3").equals(accessor.getPropertyValue("bigInteger")));
assertTrue("Correct bigInteger value", new BigInteger("3").equals(target.getBigInteger()));
assertTrue("Correct float2 value", new Float("8.1").equals(accessor.getPropertyValue("float2")));
assertTrue("Correct float2 value", new Float("8.1").equals(target.getFloat2()));
assertTrue("Correct double2 value", new Double("6.1").equals(accessor.getPropertyValue("double2")));
assertTrue("Correct double2 value", new Double("6.1").equals(target.getDouble2()));
代码示例来源:origin: aws/aws-sdk-java
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Smile == false)
return false;
Smile other = (Smile) obj;
if (other.getValue() == null ^ this.getValue() == null)
return false;
if (other.getValue() != null && other.getValue().equals(this.getValue()) == false)
return false;
if (other.getConfidence() == null ^ this.getConfidence() == null)
return false;
if (other.getConfidence() != null && other.getConfidence().equals(this.getConfidence()) == false)
return false;
return true;
}
代码示例来源:origin: spring-projects/spring-framework
assertTrue("Correct bigInteger value", new BigInteger("3").equals(bw.getPropertyValue("bigInteger")));
assertTrue("Correct bigInteger value", new BigInteger("3").equals(tb.getBigInteger()));
assertTrue("Correct float1 value", new Float("7.1").equals(bw.getPropertyValue("float1")));
assertTrue("Correct float1 value", new Float("7.1").equals(new Float(tb.getFloat1())));
assertTrue("Correct float2 value", new Float("8.1").equals(bw.getPropertyValue("float2")));
assertTrue("Correct float2 value", new Float("8.1").equals(tb.getFloat2()));
assertTrue("Correct double1 value", new Double("5.1").equals(bw.getPropertyValue("double1")));
assertTrue("Correct double1 value", tb.getDouble1() == 5.1);
代码示例来源:origin: spring-projects/spring-framework
assertTrue("Correct bigInteger value", new BigInteger("3").equals(bw.getPropertyValue("bigInteger")));
assertTrue("Correct bigInteger value", new BigInteger("3").equals(tb.getBigInteger()));
assertTrue("Correct float1 value", new Float("7.1").equals(bw.getPropertyValue("float1")));
assertTrue("Correct float1 value", new Float("7.1").equals(new Float(tb.getFloat1())));
assertTrue("Correct float2 value", new Float("8.1").equals(bw.getPropertyValue("float2")));
assertTrue("Correct float2 value", new Float("8.1").equals(tb.getFloat2()));
assertTrue("Correct double1 value", new Double("5.1").equals(bw.getPropertyValue("double1")));
assertTrue("Correct double1 value", tb.getDouble1() == 5.1);
代码示例来源:origin: MorphiaOrg/morphia
@Test
public void testFloat() throws Exception {
final ContainsFloat cf = new ContainsFloat();
getDs().save(cf);
final ContainsFloat loaded = getDs().get(cf);
assertNotNull(loaded);
assertTrue(loaded.val0 == cf.val0);
assertTrue(loaded.val1.equals(cf.val1));
}
代码示例来源:origin: spring-projects/spring-framework
request.addParameter("paramEmpty", "");
assertTrue(ServletRequestUtils.getFloatParameter(request, "param1").equals(new Float(5.5f)));
assertTrue(ServletRequestUtils.getFloatParameter(request, "param1", 6.5f) == 5.5f);
assertTrue(ServletRequestUtils.getRequiredFloatParameter(request, "param1") == 5.5f);
内容来源于网络,如有侵权,请联系作者删除!