@Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (size < 0 || !(obj instanceof BlobDescriptor)) {
      return false;
    }

    BlobDescriptor other = (BlobDescriptor) obj;
    return size == other.getSize() && digest.equals(other.getDigest());
  }
Checks if two {@link BlobDescriptor}s are equal.

<p>Two blobs are equal if their:

<ol>
  <li>{@code digest}s are not null and equal, and
  <li>{@code size}s are non-negative and equal
</ol>
jib-core/src/main/java/com/google/cloud/tools/jib/blob/BlobDescriptor.java