E
- the type of the items from which one seeks a fravrit (i.e. favorite)public class MahFravrit<E>
extends java.lang.Object
Constructor and Description |
---|
MahFravrit(java.util.Comparator<E> fravriter)
Create a new MahFravrit object with the given Comparator to discern mah fravrit ("my favorite") item of that type.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E item)
Add an item to this set of items.
|
E |
getFravrit()
Find, remove, and return the fravrit ("favorite"), item in the set of items.
|
boolean |
isEmpty()
Return whether or not any items are contained.
|
boolean |
remove(E item)
Request to remove a given item from this set.
|
public MahFravrit(java.util.Comparator<E> fravriter)
fravriter
- a Comparator for determining a favorite item given two items of a type. A Comparator implements a compare
method that takes two items as parameters, returns a positive/negative number if the first item is "greater"/"lesser"
in some sense, respectively. If the two are equivalent, a zero value is returned.public boolean isEmpty()
public void add(E item)
item
- the item to be added to this setpublic boolean remove(E item)
item
- the item requested to be removedpublic E getFravrit()