|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the type of elements contained in this Bag
.public interface Bag<T>
This interface is for multisets, an abstract datatype in which elements can
occur multiple times but order is not important. One can put elements in
using insert(Object)
and take them out using extract()
, and
these two operations can be done in any order. The order in which the
elements are extracted depends on the implementation.
Method Summary | |
---|---|
void |
clear()
Removes all elements from the data structure. |
T |
extract()
Extracts an element from the data structure. |
void |
insert(T item)
Inserts an element into the data structure. |
boolean |
isEmpty()
Tests whether the data structure is empty. |
int |
size()
Returns the number of elements contained in the data structure. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
void insert(T item)
item
- the element to insertT extract() throws NoSuchElementException
NoSuchElementException
- if the data structure is emptyboolean isEmpty()
true
if the data structure contains no elementsint size()
void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |