Ejemplo n.º 1
0
 @Override
 public boolean retainAll(final Collection<?> c) {
   final Set<C> uniqueElementsToRemove = SetElements.difference(this, c);
   final boolean result = super.retainAll(uniqueElementsToRemove);
   if (result) {
     final Set<C> uniqueRemovedElements = SetElements.intersection(this, uniqueElementsToRemove);
     setChildrenParent(uniqueRemovedElements, null);
   }
   return result;
 }
Ejemplo n.º 2
0
  @Override
  public boolean addAll(final int index, final Collection<? extends C> c) {
    final Set<? extends C> uniqueElementsToAdd = SetElements.difference(c, this);
    final boolean result = super.addAll(index, c);
    if (result) {
      final Set<C> uniqueAddedElements = SetElements.intersection(this, uniqueElementsToAdd);
      updateChildrenParent(uniqueAddedElements);
    }

    return result;
  }