public abstract class MyAbstractSet<E> extends java.lang.Object implements MySet<E>
Constructor and Description |
---|
MyAbstractSet() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
add(E e)
Add element o into the set, if it is not already present.
|
void |
addAll(MyCollection<? extends E> c)
Adds all of the elements in the specified collection to this collection
|
abstract void |
clear()
Removes all of the elements from this collection.
|
abstract boolean |
contains(E o)
Returns true if this collection contains the specified element.
|
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
abstract boolean |
remove(E o)
Removes a single instance of the specified element from this
collection, if it is present.
|
int |
size()
Returns the number of elements in this collection.
|
java.lang.String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
iterator
public int size()
MyCollection
size
in interface MyCollection<E>
public boolean isEmpty()
MyCollection
isEmpty
in interface MyCollection<E>
public void addAll(MyCollection<? extends E> c)
MyCollection
addAll
in interface MyCollection<E>
public abstract boolean contains(E o)
MyCollection
contains
in interface MyCollection<E>
o
- element whose presence in this collection is to be tested. Assume o is not null.public abstract boolean add(E e)
MySet
public abstract boolean remove(E o)
MyCollection
remove
in interface MyCollection<E>
o
- element to be removed from this collection, if present. Assume o is not null.public abstract void clear()
MyCollection
clear
in interface MyCollection<E>
public java.lang.String toString()
toString
in class java.lang.Object