public interface BagInterface<T>
Modifier and Type | Method and Description |
---|---|
boolean |
add(T newEntry)
Adds a new entry to this bag.
|
void |
clear()
Removes all entries from this bag.
|
boolean |
contains(T anEntry)
Tests whether this bag contains a given entry.
|
int |
getCurrentSize()
Gets the current number of entries in this bag.
|
int |
getFrequencyOf(T anEntry)
Counts the number of times a given entry appears in this bag.
|
boolean |
isEmpty()
Sees whether this bag is empty.
|
T |
remove()
Removes one unspecified entry from this bag, if possible.
|
boolean |
remove(T anEntry)
Removes one occurrence of a given entry from this bag.
|
T[] |
toArray()
Retrieves all entries that are in this bag.
|
int getCurrentSize()
boolean isEmpty()
boolean add(T newEntry)
newEntry
- The object to be added as a new entry.T remove()
boolean remove(T anEntry)
anEntry
- The entry to be removed.void clear()
int getFrequencyOf(T anEntry)
anEntry
- The entry to be counted.boolean contains(T anEntry)
anEntry
- The entry to locate.T[] toArray()