/** * Adds an element to a specific index in the list if it is not already present. * * <p><i>(Violation)</i> The <code>List</code> interface makes the assumption that the element is * always inserted. This may not happen with this implementation. * * @param index the index to insert at * @param object the object to add */ public void add(int index, Object object) { // adds element if it is not contained already if (set.contains(object) == false) { super.add(index, object); set.add(object); } }
/** * Adds an element to a specific index in the list if it is not already present. * * <p><i>(Violation)</i> The <code>List</code> interface makes the assumption that the element is * always inserted. This may not happen with this implementation. * * @param index the index to insert at * @param object the object to add */ @Override public void add(final int index, final E object) { // adds element if it is not contained already if (set.contains(object) == false) { super.add(index, object); set.add(object); } }