Package com.ibm.wala.util.collections
Class ArraySet<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractSet<T>
com.ibm.wala.util.collections.ArraySet<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,Set<T>
A set implementation backed by an array. This implementation is space-efficient for small sets, but several operations like
contains(Object) are linear time.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidclear()booleanstatic final <T> ArraySet<T> empty()voidforall(ObjectVisitor<T> visitor) get(int i) booleanintersects(ArraySet<T> other) iterator()static <T> ArraySet<T> make()static <T> ArraySet<T> make(Collection<T> other) booleanremove(int ind) booleanintsize()Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
ArraySet
public ArraySet(int n, boolean checkDupes) -
ArraySet
public ArraySet() -
ArraySet
- Throws:
IllegalArgumentException
-
-
Method Details
-
empty
-
add
- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceSet<T>- Overrides:
addin classAbstractCollection<T>- Throws:
UnsupportedOperationException- if thisArraySetis immutable (optional)
-
addAll
- Throws:
IllegalArgumentException
-
contains
- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceSet<T>- Overrides:
containsin classAbstractCollection<T>
-
intersects
- Throws:
IllegalArgumentException
-
forall
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceSet<T>- Specified by:
sizein classAbstractCollection<T>
-
get
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size()).
-
remove
- Specified by:
removein interfaceCollection<T>- Specified by:
removein interfaceSet<T>- Overrides:
removein classAbstractCollection<T>
-
remove
public boolean remove(int ind) - Returns:
true(SJF: So why return a value?)
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>- Specified by:
clearin interfaceSet<T>- Overrides:
clearin classAbstractCollection<T>
-
iterator
-
make
-
make
- Throws:
IllegalArgumentException
-