/** * Description: Works just like java.util.ArrayList, except it will refuse to * add an element if it is equal to an element already appearing in the * ArrayListSet. In other words, it's an ArrayList which maintains uniqueness * like java.util.Set does. * * @author Kerry M. Soileau *
* @version 1.3 */ import java.util.*; public class ArrayListSet extends ArrayList implements Set { /** * Constructs a new, empty ArrayListSet. */ public ArrayListSet() { } /** * Constructs a new set containing space for the specified number of objects. * * @param n The capacity of the new set. */ public ArrayListSet(int n) { super(n); } /** * Constructs a new set containing the elements in the specified * collection. * * @param c The elements that will comprise the new set. */ public ArrayListSet(Collection c) { addAll(c); } /** * Adds the specified element to this set if it is not already present. * * @param o element to be added to this set. * @return true if the set did not already contain the specified * element. */ public boolean add(Object o) { for(int i=0;i* ksoileau@wt.net * http://web.wt.net/~ksoileau/index.htm *