Package it.unimi.di.prog2.h17
Class MaxIntSet
java.lang.Object
it.unimi.di.prog2.h14.IntSet
it.unimi.di.prog2.h17.MaxIntSet
-
Field Summary
-
Constructor Summary
-
Method Summary
Methods inherited from class it.unimi.di.prog2.h14.IntSet
choose, equals, hashCode, isIn, iterator, size
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
biggest
private int biggestThe biggest element, if set is not empty
-
-
Constructor Details
-
MaxIntSet
public MaxIntSet()Construct an emptyMaxIntSet
.
-
-
Method Details
-
insert
public void insert(int x) Description copied from class:IntSet
Adds the given element to this set.This method modifies the object, that is: \( S' = S \cup \{ x \} \).
-
remove
public void remove(int x) Description copied from class:IntSet
Removes the given element from this set.This method modifies the object, that is: \( S' = S \setminus \{ x \} \).
-
max
Returns the maximum value in the set, or risesEmptyException
otherwise.- Returns:
- the maximum value in the set.
- Throws:
EmptyException
- if the set is empty.
-
repOk
public boolean repOk() -
toString
-