com.bumptech.glide.util.Util.bothNullOrEqual()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(111)

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

Util.bothNullOrEqual介绍

[英]Null-safe equivalent of a.equals(b).
[中]a.equals(b)的空安全等价物。

代码示例

代码示例来源:origin: bumptech/glide

@Override
public boolean equals(Object obj) {
 if (obj instanceof GifUrlSet) {
  GifUrlSet other = (GifUrlSet) obj;
  return Util.bothNullOrEqual(original, other.original)
    && Util.bothNullOrEqual(fixed_width, other.fixed_width)
    && Util.bothNullOrEqual(fixed_height, other.fixed_height);
 }
 return false;
}

代码示例来源:origin: bumptech/glide

@Override
public boolean equals(Object obj) {
 if (obj instanceof GifResult) {
  GifResult other = (GifResult) obj;
  return Util.bothNullOrEqual(id, other.id)
    && Util.bothNullOrEqual(images, other.images);
 }
 return false;
}

代码示例来源:origin: bumptech/glide

@Override
public boolean equals(Object obj) {
 if (obj instanceof GifImage) {
  GifImage other = (GifImage) obj;
  return other.width == width
    && other.height == height
    && Util.bothNullOrEqual(url, other.url);
 }
 return false;
}

代码示例来源:origin: bumptech/glide

@Override
public boolean equals(Object o) {
 if (o instanceof Key) {
  Key other = (Key) o;
  return size == other.size
    && Util.bothNullOrEqual(config, other.config);
 }
 return false;
}

代码示例来源:origin: bumptech/glide

@Override
public boolean equals(Object o) {
 if (o instanceof BaseRequestOptions<?>) {
  BaseRequestOptions<?> other = (BaseRequestOptions<?>) o;
  return Float.compare(other.sizeMultiplier, sizeMultiplier) == 0
    && errorId == other.errorId
    && Util.bothNullOrEqual(errorPlaceholder, other.errorPlaceholder)
    && placeholderId == other.placeholderId
    && Util.bothNullOrEqual(placeholderDrawable, other.placeholderDrawable)
    && fallbackId == other.fallbackId
    && Util.bothNullOrEqual(fallbackDrawable, other.fallbackDrawable)
    && isCacheable == other.isCacheable
    && overrideHeight == other.overrideHeight
    && overrideWidth == other.overrideWidth
    && isTransformationRequired == other.isTransformationRequired
    && isTransformationAllowed == other.isTransformationAllowed
    && useUnlimitedSourceGeneratorsPool == other.useUnlimitedSourceGeneratorsPool
    && onlyRetrieveFromCache == other.onlyRetrieveFromCache
    && diskCacheStrategy.equals(other.diskCacheStrategy)
    && priority == other.priority
    && options.equals(other.options)
    && transformations.equals(other.transformations)
    && resourceClass.equals(other.resourceClass)
    && Util.bothNullOrEqual(signature, other.signature)
    && Util.bothNullOrEqual(theme, other.theme);
 }
 return false;
}

代码示例来源:origin: bumptech/glide

@SuppressWarnings({"PMD.SimplifyBooleanReturns", "RedundantIfStatement"})
@Override
public boolean equals(Object o) {
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 MultiClassKey that = (MultiClassKey) o;
 if (!first.equals(that.first)) {
  return false;
 }
 if (!second.equals(that.second)) {
  return false;
 }
 if (!Util.bothNullOrEqual(third, that.third)) {
  return false;
 }
 return true;
}

代码示例来源:origin: bumptech/glide

@Override
public boolean equals(Object o) {
 if (o instanceof ResourceCacheKey) {
  ResourceCacheKey other = (ResourceCacheKey) o;
  return height == other.height && width == other.width
    && Util.bothNullOrEqual(transformation, other.transformation)
    && decodedResourceClass.equals(other.decodedResourceClass)
    && sourceKey.equals(other.sourceKey)
    && signature.equals(other.signature)
    && options.equals(other.options);
 }
 return false;
}

代码示例来源:origin: mozilla-tw/Rocket

@Override
public boolean equals(Object o) {
 if (o instanceof Key) {
  Key other = (Key) o;
  return size == other.size
    && Util.bothNullOrEqual(config, other.config);
 }
 return false;
}

代码示例来源:origin: bumptech/glide

Drawable second = new GradientDrawable();
assertThat(first).isNotEqualTo(second);
assertThat(Util.bothNullOrEqual(first, second)).isFalse();
new EqualsTester()
  .addEqualityGroup(

代码示例来源:origin: mozilla-tw/Rocket

@Override
public boolean equals(Object o) {
 if (o instanceof RequestOptions) {
  RequestOptions other = (RequestOptions) o;
  return Float.compare(other.sizeMultiplier, sizeMultiplier) == 0
    && errorId == other.errorId
    && Util.bothNullOrEqual(errorPlaceholder, other.errorPlaceholder)
    && placeholderId == other.placeholderId
    && Util.bothNullOrEqual(placeholderDrawable, other.placeholderDrawable)
    && fallbackId == other.fallbackId
    && Util.bothNullOrEqual(fallbackDrawable, other.fallbackDrawable)
    && isCacheable == other.isCacheable
    && overrideHeight == other.overrideHeight
    && overrideWidth == other.overrideWidth
    && isTransformationRequired == other.isTransformationRequired
    && isTransformationAllowed == other.isTransformationAllowed
    && useUnlimitedSourceGeneratorsPool == other.useUnlimitedSourceGeneratorsPool
    && onlyRetrieveFromCache == other.onlyRetrieveFromCache
    && diskCacheStrategy.equals(other.diskCacheStrategy)
    && priority == other.priority
    && options.equals(other.options)
    && transformations.equals(other.transformations)
    && resourceClass.equals(other.resourceClass)
    && Util.bothNullOrEqual(signature, other.signature)
    && Util.bothNullOrEqual(theme, other.theme);
 }
 return false;
}

代码示例来源:origin: mozilla-tw/Rocket

@SuppressWarnings({"PMD.SimplifyBooleanReturns", "RedundantIfStatement"})
@Override
public boolean equals(Object o) {
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 MediaStoreSignature that = (MediaStoreSignature) o;
 if (dateModified != that.dateModified) {
  return false;
 }
 if (orientation != that.orientation) {
  return false;
 }
 if (!Util.bothNullOrEqual(mimeType, that.mimeType)) {
  return false;
 }
 return true;
}

代码示例来源:origin: mozilla-tw/Rocket

@SuppressWarnings({"PMD.SimplifyBooleanReturns", "RedundantIfStatement"})
@Override
public boolean equals(Object o) {
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 MultiClassKey that = (MultiClassKey) o;
 if (!first.equals(that.first)) {
  return false;
 }
 if (!second.equals(that.second)) {
  return false;
 }
 if (!Util.bothNullOrEqual(third, that.third)) {
  return false;
 }
 return true;
}

代码示例来源:origin: mozilla-tw/Rocket

@Override
public boolean equals(Object o) {
 if (o instanceof ResourceCacheKey) {
  ResourceCacheKey other = (ResourceCacheKey) o;
  return height == other.height && width == other.width
    && Util.bothNullOrEqual(transformation, other.transformation)
    && decodedResourceClass.equals(other.decodedResourceClass)
    && sourceKey.equals(other.sourceKey)
    && signature.equals(other.signature)
    && options.equals(other.options);
 }
 return false;
}

相关文章