@Override public boolean addAllUnique(int index, Collection<? extends E> objects) { int size = objects.size(); if (size > 0) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); if (doAddAllUnique(index, objects)) { NotificationImpl notification = size == 1 ? createNotification(Notification.ADD, null, objects .iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, objects, index, oldIsSet); dispatchNotification(notification); return true; } } else { return doAddAllUnique(index, objects); } } return false; }
@Override public boolean addAllUnique(int index, Collection<? extends E> objects) { int size = objects.size(); if (size > 0) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); if (doAddAllUnique(index, objects)) { NotificationImpl notification = size == 1 ? createNotification(Notification.ADD, null, objects .iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, objects, index, oldIsSet); dispatchNotification(notification); return true; } } else { return doAddAllUnique(index, objects); } } return false; }
@Override public E remove(int index) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); NotificationImpl notification = createNotification( Notification.REMOVE, super.remove(index), null, index, oldIsSet); dispatchNotification(notification); @SuppressWarnings("unchecked") E oldValue = (E) notification.getOldValue(); return oldValue; } else { return super.remove(index); } }
@Override public void addUnique(int index, E object) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); super.add(index, validate(index, object)); NotificationImpl notification = createNotification( Notification.ADD, null, object, index, oldIsSet); dispatchNotification(notification); } else { super.add(index, validate(index, object)); } }
@Override public void addUnique(int index, E object) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); super.add(index, validate(index, object)); NotificationImpl notification = createNotification( Notification.ADD, null, object, index, oldIsSet); dispatchNotification(notification); } else { super.add(index, validate(index, object)); } }
@Override public E remove(int index) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); NotificationImpl notification = createNotification( Notification.REMOVE, super.remove(index), null, index, oldIsSet); dispatchNotification(notification); @SuppressWarnings("unchecked") E oldValue = (E) notification.getOldValue(); return oldValue; } else { return super.remove(index); } }
@Override public E setUnique(int index, E object) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); Notification notification = createNotification(Notification.SET, super.set(index, validate(index, object)), object, index, oldIsSet); dispatchNotification(notification); @SuppressWarnings("unchecked") E oldValue = (E) notification.getOldValue(); return oldValue; } else { return super.set(index, validate(index, object)); } }
@Override public E setUnique(int index, E object) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); Notification notification = createNotification(Notification.SET, super.set(index, validate(index, object)), object, index, oldIsSet); dispatchNotification(notification); @SuppressWarnings("unchecked") E oldValue = (E) notification.getOldValue(); return oldValue; } else { return super.set(index, validate(index, object)); } }