diff --git a/projects/samskivert/src/java/com/samskivert/util/ArrayIntSet.java b/projects/samskivert/src/java/com/samskivert/util/ArrayIntSet.java index 9010d6eb..7831d3a2 100644 --- a/projects/samskivert/src/java/com/samskivert/util/ArrayIntSet.java +++ b/projects/samskivert/src/java/com/samskivert/util/ArrayIntSet.java @@ -1,5 +1,5 @@ // -// $Id: ArrayIntSet.java,v 1.1 2002/02/03 07:10:16 mdb Exp $ +// $Id: ArrayIntSet.java,v 1.2 2002/04/17 00:19:41 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -39,6 +39,18 @@ public class ArrayIntSet extends AbstractSet return _size; } + /** + * Returns the element at the specified index. Note that the elements + * in the set are unordered and could change order after insertion or + * removal. This method is useful only for accessing elements of a + * static set (and has the desirable property of allowing access to + * the values in this set without having to create integer objects). + */ + public int get (int index) + { + return _values[index]; + } + // documentation inherited from interface public boolean isEmpty () { @@ -180,6 +192,25 @@ public class ArrayIntSet extends AbstractSet return false; } + /** + * Removes all values in the supplied array from the set. Any values + * that are in the array but not in the set are simply ignored. + * + * @param values elements to be removed from the set. + * + * @return true if this set contained any of the specified + * elements (which will have been removed). + */ + public boolean remove (int[] values) + { + boolean modified = false; + int vcount = values.length; + for (int i = 0; i < vcount; i++) { + modified = (remove(values[i]) || modified); + } + return modified; + } + // documentation inherited from interface public boolean containsAll (Collection c) {