public interface MyCollection<E>
extends java.lang.Iterable<E>
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o)
Add element o into (the end of) the collection.
|
void |
addAll(MyCollection<? extends E> c)
Adds all of the elements in the specified collection to this collection
|
void |
clear()
Removes all of the elements from this collection.
|
boolean |
contains(E o)
Returns true if this collection contains the specified element.
|
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this collection.
|
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.
|
int size()
boolean isEmpty()
boolean contains(E o)
o
- element whose presence in this collection is to be tested. Assume o is not null.boolean add(E o)
o
- element whose presence in this collection is to be ensured. Assume o is not null.void addAll(MyCollection<? extends E> c)
boolean remove(E o)
o
- element to be removed from this collection, if present. Assume o is not null.void clear()
java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>