/** * Returns <tt>true</tt> if this list contains the specified element. * * @param object element whose presence in this list is to be tested * @return <tt>true</tt> if this list contains the specified element */ @Override public boolean contains(Object object) { return indexOf(object) >= 0; }
/** * Removes the first occurrence of the specified element from this list, * if it is present. If the list does not contain the element, it is * unchanged. * * @param object element to be removed from this list, if present * @return <tt>true</tt> if this list contained the specified element */ @Override public boolean remove(Object object) { int index = indexOf(object); if (index == -1) return false; else { remove(index); return true; } }