T
- public class ArraySet<T> extends AbstractSet<T>
contains(Object)
are linear time.Modifier and Type | Class and Description |
---|---|
class |
ArraySet.ArraySetIterator |
Constructor and Description |
---|
ArraySet() |
ArraySet(ArraySet<T> other) |
ArraySet(int n,
boolean checkDupes) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T o) |
boolean |
addAll(ArraySet<T> other) |
void |
clear() |
boolean |
contains(Object obj_) |
static <T> ArraySet<T> |
empty() |
void |
forall(ObjectVisitor<T> visitor) |
T |
get(int i) |
boolean |
intersects(ArraySet<T> other) |
Iterator<T> |
iterator() |
static <T> ArraySet<T> |
make() |
static <T> ArraySet<T> |
make(Collection<T> other) |
boolean |
remove(int ind) |
boolean |
remove(Object obj_) |
int |
size() |
equals, hashCode, removeAll
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public ArraySet(int n, boolean checkDupes)
public ArraySet()
public ArraySet(ArraySet<T> other) throws IllegalArgumentException
IllegalArgumentException
public static final <T> ArraySet<T> empty()
public boolean add(T o)
add
in interface Collection<T>
add
in interface Set<T>
add
in class AbstractCollection<T>
UnsupportedOperationException
- if this ArraySet
is immutable (optional)public boolean addAll(ArraySet<T> other) throws IllegalArgumentException
IllegalArgumentException
public boolean contains(Object obj_)
contains
in interface Collection<T>
contains
in interface Set<T>
contains
in class AbstractCollection<T>
public boolean intersects(ArraySet<T> other) throws IllegalArgumentException
IllegalArgumentException
public void forall(ObjectVisitor<T> visitor)
public int size()
size
in interface Collection<T>
size
in interface Set<T>
size
in class AbstractCollection<T>
public T get(int i)
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()).public boolean remove(Object obj_)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class AbstractCollection<T>
public boolean remove(int ind)
true
(SJF: So why return a value?)public void clear()
clear
in interface Collection<T>
clear
in interface Set<T>
clear
in class AbstractCollection<T>
public static <T> ArraySet<T> make()
public static <T> ArraySet<T> make(Collection<T> other) throws IllegalArgumentException
IllegalArgumentException