java.lang.Short.equals()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(16.3k)|赞(0)|评价(0)|浏览(92)

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

Short.equals介绍

[英]Compares this instance with the specified object and indicates if they are equal. In order to be equal, object must be an instance of Short and have the same short value as this object.
[中]将此实例与指定的对象进行比较,并指示它们是否相等。要使其相等,对象必须是Short的实例,并且具有与此对象相同的Short值。

代码示例

代码示例来源:origin: libgdx/libgdx

if (ShortField == null) {
  if (other.ShortField != null) return false;
} else if (!ShortField.equals(other.ShortField)) return false;
if (stringField == null) {
  if (other.stringField != null) return false;

代码示例来源:origin: alibaba/druid

return castToShort(a).equals(castToShort(b));

代码示例来源:origin: linlinjava/litemall

@RequiresPermissions("admin:coupon:create")
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="添加")
@PostMapping("/create")
public Object create(@RequestBody LitemallCoupon coupon) {
  Object error = validate(coupon);
  if (error != null) {
    return error;
  }
  // 如果是兑换码类型,则这里需要生存一个兑换码
  if (coupon.getType().equals(CouponConstant.TYPE_CODE)){
    String code = couponService.generateCode();
    coupon.setCode(code);
  }
  couponService.add(coupon);
  return ResponseUtil.ok(coupon);
}

代码示例来源:origin: hibernate/hibernate-orm

public boolean equalsFoo(Foo other) {
  if ( _bytes!=other._bytes ) {
    if ( _bytes==null || other._bytes==null ) return false;
    if ( _bytes.length!=other._bytes.length ) return false;
    for ( int i=0; i< _bytes.length; i++) {
      if ( _bytes[i] != other._bytes[i] ) return false;
    }
  }
  return ( this._bool == other._bool )
  && ( ( this._boolean == other._boolean ) || ( this._boolean.equals(other._boolean) ) )
  && ( ( this._byte == other._byte ) || ( this._byte.equals(other._byte) ) )
  //&& ( ( this._date == other._date ) || ( this._date.getDate() == other._date.getDate() && this._date.getMonth() == other._date.getMonth() && this._date.getYear() == other._date.getYear() ) )
  && ( ( this._double == other._double ) || ( this._double.equals(other._double) ) )
  && ( ( this._float == other._float ) || ( this._float.equals(other._float) ) )
  && ( this._int == other._int )
  && ( ( this._integer == other._integer ) || ( this._integer.equals(other._integer) ) )
  && ( ( this._long == other._long ) || ( this._long.equals(other._long) ) )
  && ( this._null == other._null )
  && ( ( this._short == other._short ) || ( this._short.equals(other._short) ) )
  && ( ( this._string == other._string) || ( this._string.equals(other._string) ) )
  //&& ( ( this._timestamp==other._timestamp) || ( this._timestamp.getDate() == other._timestamp.getDate() && this._timestamp.getYear() == other._timestamp.getYear() && this._timestamp.getMonth() == other._timestamp.getMonth() ) )
  && ( this._zero == other._zero )
  && ( ( this._foo == other._foo ) || ( this._foo.getKey().equals( other._foo.getKey() ) ) )
  && ( ( this.blob == other.blob ) || ( this.blob.equals(other.blob) ) )
  && ( this.yesno == other.yesno )
  && ( ( this.binary == other.binary ) || java.util.Arrays.equals(this.binary, other.binary) )
  && ( this.key.equals(other.key) )
  && ( this.theLocale.equals(other.theLocale) )
  && ( ( this.custom == other.custom ) || ( this.custom[0].equals(other.custom[0]) && this.custom[1].equals(other.custom[1]) ) );
}

代码示例来源:origin: spring-projects/spring-framework

assertTrue("Correct short2 value", new Short("2").equals(accessor.getPropertyValue("short2")));
assertTrue("Correct short2 value", new Short("2").equals(target.getShort2()));
assertTrue("Correct int2 value", new Integer("8").equals(accessor.getPropertyValue("int2")));
assertTrue("Correct int2 value", new Integer("8").equals(target.getInt2()));

代码示例来源:origin: prestodb/presto

if (testString.equals(row.getField(columnIndex.get("t_string"))) &&
    testInt.equals(row.getField(columnIndex.get("t_int"))) &&
    testSmallint.equals(row.getField(columnIndex.get("t_smallint")))) {
  rowFound = true;

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@SuppressWarnings({"BigDecimalEquals", "EqualsHashCodeCalledOnUrl", "RedundantIfStatement"})
@Override public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  TestObject that = (TestObject)o;
  if (id != that.id) return false;
  if (!Arrays.equals(arrVal, that.arrVal)) return false;
  if (bigVal != null ? !bigVal.equals(that.bigVal) : that.bigVal != null) return false;
  if (boolVal != null ? !boolVal.equals(that.boolVal) : that.boolVal != null) return false;
  if (byteVal != null ? !byteVal.equals(that.byteVal) : that.byteVal != null) return false;
  if (dateVal != null ? !dateVal.equals(that.dateVal) : that.dateVal != null) return false;
  if (doubleVal != null ? !doubleVal.equals(that.doubleVal) : that.doubleVal != null) return false;
  if (f1 != null ? !f1.equals(that.f1) : that.f1 != null) return false;
  if (f2 != null ? !f2.equals(that.f2) : that.f2 != null) return false;
  if (f3 != null ? !f3.equals(that.f3) : that.f3 != null) return false;
  if (floatVal != null ? !floatVal.equals(that.floatVal) : that.floatVal != null) return false;
  if (intVal != null ? !intVal.equals(that.intVal) : that.intVal != null) return false;
  if (longVal != null ? !longVal.equals(that.longVal) : that.longVal != null) return false;
  if (shortVal != null ? !shortVal.equals(that.shortVal) : that.shortVal != null) return false;
  if (strVal != null ? !strVal.equals(that.strVal) : that.strVal != null) return false;
  if (timeVal != null ? !timeVal.equals(that.timeVal) : that.timeVal != null) return false;
  if (tsVal != null ? !tsVal.equals(that.tsVal) : that.tsVal != null) return false;
  if (urlVal != null ? !urlVal.equals(that.urlVal) : that.urlVal != null) return false;
  return true;
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@SuppressWarnings({"BigDecimalEquals", "EqualsHashCodeCalledOnUrl", "RedundantIfStatement"})
@Override public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  TestObject that = (TestObject)o;
  if (id != that.id) return false;
  if (!Arrays.equals(arrVal, that.arrVal)) return false;
  if (bigVal != null ? !bigVal.equals(that.bigVal) : that.bigVal != null) return false;
  if (boolVal != null ? !boolVal.equals(that.boolVal) : that.boolVal != null) return false;
  if (byteVal != null ? !byteVal.equals(that.byteVal) : that.byteVal != null) return false;
  if (dateVal != null ? !dateVal.equals(that.dateVal) : that.dateVal != null) return false;
  if (doubleVal != null ? !doubleVal.equals(that.doubleVal) : that.doubleVal != null) return false;
  if (f1 != null ? !f1.equals(that.f1) : that.f1 != null) return false;
  if (f2 != null ? !f2.equals(that.f2) : that.f2 != null) return false;
  if (f3 != null ? !f3.equals(that.f3) : that.f3 != null) return false;
  if (floatVal != null ? !floatVal.equals(that.floatVal) : that.floatVal != null) return false;
  if (intVal != null ? !intVal.equals(that.intVal) : that.intVal != null) return false;
  if (longVal != null ? !longVal.equals(that.longVal) : that.longVal != null) return false;
  if (shortVal != null ? !shortVal.equals(that.shortVal) : that.shortVal != null) return false;
  if (strVal != null ? !strVal.equals(that.strVal) : that.strVal != null) return false;
  if (timeVal != null ? !timeVal.equals(that.timeVal) : that.timeVal != null) return false;
  if (tsVal != null ? !tsVal.equals(that.tsVal) : that.tsVal != null) return false;
  if (urlVal != null ? !urlVal.equals(that.urlVal) : that.urlVal != null) return false;
  return true;
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@SuppressWarnings({"BigDecimalEquals", "EqualsHashCodeCalledOnUrl", "RedundantIfStatement"})
@Override public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  TestObject that = (TestObject)o;
  if (id != that.id) return false;
  if (!Arrays.equals(arrVal, that.arrVal)) return false;
  if (bigVal != null ? !bigVal.equals(that.bigVal) : that.bigVal != null) return false;
  if (boolVal != null ? !boolVal.equals(that.boolVal) : that.boolVal != null) return false;
  if (byteVal != null ? !byteVal.equals(that.byteVal) : that.byteVal != null) return false;
  if (dateVal != null ? !dateVal.equals(that.dateVal) : that.dateVal != null) return false;
  if (doubleVal != null ? !doubleVal.equals(that.doubleVal) : that.doubleVal != null) return false;
  if (f1 != null ? !f1.equals(that.f1) : that.f1 != null) return false;
  if (f2 != null ? !f2.equals(that.f2) : that.f2 != null) return false;
  if (f3 != null ? !f3.equals(that.f3) : that.f3 != null) return false;
  if (floatVal != null ? !floatVal.equals(that.floatVal) : that.floatVal != null) return false;
  if (intVal != null ? !intVal.equals(that.intVal) : that.intVal != null) return false;
  if (longVal != null ? !longVal.equals(that.longVal) : that.longVal != null) return false;
  if (shortVal != null ? !shortVal.equals(that.shortVal) : that.shortVal != null) return false;
  if (strVal != null ? !strVal.equals(that.strVal) : that.strVal != null) return false;
  if (timeVal != null ? !timeVal.equals(that.timeVal) : that.timeVal != null) return false;
  if (tsVal != null ? !tsVal.equals(that.tsVal) : that.tsVal != null) return false;
  if (urlVal != null ? !urlVal.equals(that.urlVal) : that.urlVal != null) return false;
  return true;
}

代码示例来源:origin: spring-projects/spring-framework

assertTrue("Correct short2 value", new Short("2").equals(accessor.getPropertyValue("short2")));
assertTrue("Correct short2 value", new Short("2").equals(target.getShort2()));
assertTrue("Correct int2 value", new Integer("8").equals(accessor.getPropertyValue("int2")));
assertTrue("Correct int2 value", new Integer("8").equals(target.getInt2()));

代码示例来源:origin: spring-projects/spring-framework

bw.setPropertyValue("bigDecimal", "4.5");
assertTrue("Correct short1 value", new Short("1").equals(bw.getPropertyValue("short1")));
assertTrue("Correct short1 value", tb.getShort1() == 1);
assertTrue("Correct short2 value", new Short("2").equals(bw.getPropertyValue("short2")));
assertTrue("Correct short2 value", new Short("2").equals(tb.getShort2()));
assertTrue("Correct int1 value", new Integer("7").equals(bw.getPropertyValue("int1")));
assertTrue("Correct int1 value", tb.getInt1() == 7);

代码示例来源:origin: linlinjava/litemall

&& (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount()))
&& (this.getMin() == null ? other.getMin() == null : this.getMin().equals(other.getMin()))
&& (this.getLimit() == null ? other.getLimit() == null : this.getLimit().equals(other.getLimit()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getGoodsType() == null ? other.getGoodsType() == null : this.getGoodsType().equals(other.getGoodsType()))
&& (Arrays.equals(this.getGoodsValue(), other.getGoodsValue()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getTimeType() == null ? other.getTimeType() == null : this.getTimeType().equals(other.getTimeType()))
&& (this.getDays() == null ? other.getDays() == null : this.getDays().equals(other.getDays()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))

代码示例来源:origin: spring-projects/spring-framework

bw.setPropertyValue("bigDecimal", "4,5");
assertTrue("Correct short1 value", new Short("1").equals(bw.getPropertyValue("short1")));
assertTrue("Correct short1 value", tb.getShort1() == 1);
assertTrue("Correct short2 value", new Short("2").equals(bw.getPropertyValue("short2")));
assertTrue("Correct short2 value", new Short("2").equals(tb.getShort2()));
assertTrue("Correct int1 value", new Integer("7").equals(bw.getPropertyValue("int1")));
assertTrue("Correct int1 value", tb.getInt1() == 7);

代码示例来源:origin: linlinjava/litemall

&& (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (this.getNumber() == null ? other.getNumber() == null : this.getNumber().equals(other.getNumber()))
&& (Arrays.equals(this.getSpecifications(), other.getSpecifications()))
&& (this.getChecked() == null ? other.getChecked() == null : this.getChecked().equals(other.getChecked()))

代码示例来源:origin: linlinjava/litemall

&& (this.getGoodsSn() == null ? other.getGoodsSn() == null : this.getGoodsSn().equals(other.getGoodsSn()))
&& (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
&& (this.getNumber() == null ? other.getNumber() == null : this.getNumber().equals(other.getNumber()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (Arrays.equals(this.getSpecifications(), other.getSpecifications()))

代码示例来源:origin: linlinjava/litemall

/**
 * This method was generated by MyBatis Generator.
 * This method corresponds to the database table litemall_comment
 *
 * @mbg.generated
 */
@Override
public boolean equals(Object that) {
  if (this == that) {
    return true;
  }
  if (that == null) {
    return false;
  }
  if (getClass() != that.getClass()) {
    return false;
  }
  LitemallComment other = (LitemallComment) that;
  return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
    && (this.getValueId() == null ? other.getValueId() == null : this.getValueId().equals(other.getValueId()))
    && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
    && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
    && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
    && (this.getHasPicture() == null ? other.getHasPicture() == null : this.getHasPicture().equals(other.getHasPicture()))
    && (Arrays.equals(this.getPicUrls(), other.getPicUrls()))
    && (this.getStar() == null ? other.getStar() == null : this.getStar().equals(other.getStar()))
    && (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
    && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
    && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
}

代码示例来源:origin: linlinjava/litemall

/**
 * This method was generated by MyBatis Generator.
 * This method corresponds to the database table litemall_coupon_user
 *
 * @mbg.generated
 */
@Override
public boolean equals(Object that) {
  if (this == that) {
    return true;
  }
  if (that == null) {
    return false;
  }
  if (getClass() != that.getClass()) {
    return false;
  }
  LitemallCouponUser other = (LitemallCouponUser) that;
  return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
    && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
    && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
    && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
    && (this.getUsedTime() == null ? other.getUsedTime() == null : this.getUsedTime().equals(other.getUsedTime()))
    && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
    && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
    && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
    && (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
    && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
    && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
}

代码示例来源:origin: linlinjava/litemall

couponUser.setUserId(userId);
Short timeType = coupon.getTimeType();
if (timeType.equals(CouponConstant.TIME_TYPE_TIME)) {
  couponUser.setStartTime(coupon.getStartTime());
  couponUser.setEndTime(coupon.getEndTime());

代码示例来源:origin: linlinjava/litemall

if (!order.getOrderStatus().equals(OrderUtil.STATUS_PAY)) {
  return ResponseUtil.fail(ORDER_CONFIRM_NOT_ALLOWED, "订单不能确认收货");

代码示例来源:origin: MorphiaOrg/morphia

@Test
public void testShort() throws Exception {
  final ContainsShort cs = new ContainsShort();
  getDs().save(cs);
  final ContainsShort loaded = getDs().get(cs);
  assertNotNull(loaded);
  assertTrue(loaded.val0 == cs.val0);
  assertTrue(loaded.val1.equals(cs.val1));
}

相关文章