/** * Returns <tt>true</tt> if this list contains the specified element. * * @param elem element whose presence in this List is to be tested. * @return <code>true</code> if the specified element is present; * <code>false</code> otherwise. */ @Override public boolean contains(int elem) { return indexOf(elem) >= 0; }
/** * Searches for the first occurrence of the given argument, testing * for equality using the <tt>equals</tt> method. * * @param elem an object. * @return the index of the first occurrence of the argument in this * list; returns <tt>-1</tt> if the object is not found. * @see Object#equals(Object) */ @Override public int indexOf(Object elem) { if (elem == null) return -1; if (elem instanceof Number) return indexOf(((Number)elem).intValue()); return -1; }