src/Entity/Entity.php
public function is($object)
    {
        if ($object instanceof EntityInterface) {
            if ($this->isLoaded()) {
                return $object->isLoaded() && get_class($this) == get_class($object) && $this->getId() == $object->getId();
            } else {
                foreach ($this->getFields() as $field_name) {
                    if (!$object->fieldExists($field_name) || !$this->areFieldValuesSame($this->getFieldValue($field_name), $object->getFieldValue($field_name))) {
                        return false;
                    }
                }

                return true;
            }
        }

        return false;
    }
public function is($object)
    {
        if ($object instanceof EntityInterface) {
            if ($this->isLoaded()) {
                return $object->isLoaded() && get_class($this) == get_class($object) && $this->getId() == $object->getId();
            } else {
                foreach ($this->getFields() as $field_name) {
                    if (!$object->fieldExists($field_name) || !$this->areFieldValuesSame($this->getFieldValue($field_name), $object->getFieldValue($field_name))) {
                        return false;
                    }
                }

                return true;
            }
        }

        return false;
    }
{@inheritdoc}