You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicabstractclassAbstractCollection<E> implementsCollection<E> {
/** * {@inheritDoc} * * @implSpec * This implementation iterates over the collection looking for the * specified element. If it finds the element, it removes the element * from the collection << using the iterator's remove method.>> * * <p>Note that this implementation throws an * {@code UnsupportedOperationException} <<if the iterator returned by this * collection's iterator method does not implement the {@code remove} * method and this collection contains the specified object.>> * * @throws UnsupportedOperationException {@inheritDoc} * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */publicbooleanremove(Objecto) {
Iterator<E> it = iterator();
if (o == null) {
while (it.hasNext()) {
if (it.next() == null) {
it.remove();
returntrue;
}
}
}
//...
}
}
@implSpec 태그를 붙여주면 javaDoc 도구가 절 생성
AbstractCollection.remove() 안에서 Iterator.remove()를 사용