{
    if (isNotificationRequired())
    {
      NotificationChain notifications = null;
      boolean oldIsSet = isSet();
      E oldObject;
      Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
      if (hasInverse() && !equalObjects(oldObject, object))
      {
        if (oldObject != null)
        {
          notifications = inverseRemove(oldObject, notifications);
        }

        notifications = inverseAdd(object, notifications);

        if (hasShadow())
        {
          notifications = shadowSet(oldObject, object, notifications);
        }

        if (notifications == null)
        {
          dispatchNotification(notification);
        }
        else
        {
          notifications.add(notification);
          notifications.dispatch();
        }
      }
      else
      {
        if (hasShadow())
        {
          notifications = shadowSet(oldObject, object, notifications);
        }

        if (notifications == null)
        {
          dispatchNotification(notification);
        }
        else
        {
          notifications.add(notification);
          notifications.dispatch();
        }
      }

      return oldObject;
    }
    else
    {
      E oldObject = doSetUnique(index, object);
      if (hasInverse() && !equalObjects(oldObject, object))
      {
        NotificationChain notifications = null;
        if (oldObject != null)
        {
          notifications = inverseRemove(oldObject, null);
        }
        notifications = inverseAdd(object, notifications);
        if (notifications != null) notifications.dispatch();
      }
      return oldObject;
    }
  }