equal
deleted
inserted
replaced
669 * (<a href="Collection.html#optional-restrictions">optional</a>), |
669 * (<a href="Collection.html#optional-restrictions">optional</a>), |
670 * or if the specified collection is null |
670 * or if the specified collection is null |
671 * @see Collection#contains(Object) |
671 * @see Collection#contains(Object) |
672 */ |
672 */ |
673 public boolean removeAll(Collection<?> c) { |
673 public boolean removeAll(Collection<?> c) { |
|
674 Objects.requireNonNull(c); |
674 return batchRemove(c, false); |
675 return batchRemove(c, false); |
675 } |
676 } |
676 |
677 |
677 /** |
678 /** |
678 * Retains only the elements in this list that are contained in the |
679 * Retains only the elements in this list that are contained in the |
689 * (<a href="Collection.html#optional-restrictions">optional</a>), |
690 * (<a href="Collection.html#optional-restrictions">optional</a>), |
690 * or if the specified collection is null |
691 * or if the specified collection is null |
691 * @see Collection#contains(Object) |
692 * @see Collection#contains(Object) |
692 */ |
693 */ |
693 public boolean retainAll(Collection<?> c) { |
694 public boolean retainAll(Collection<?> c) { |
|
695 Objects.requireNonNull(c); |
694 return batchRemove(c, true); |
696 return batchRemove(c, true); |
695 } |
697 } |
696 |
698 |
697 private boolean batchRemove(Collection<?> c, boolean complement) { |
699 private boolean batchRemove(Collection<?> c, boolean complement) { |
698 final Object[] elementData = this.elementData; |
700 final Object[] elementData = this.elementData; |