Implementazione del sottotipo 4
public class MaxIntSet extends IntSet {
// OVERVIEW: un MaxIntSet č un sottotipo di IntSet che lo estende con
private int mass; // l’elemento massimo, se this non č vuoto
public void remove (int x) {
if (size() == 0 || x < mass) return;
mass = ((Integer) g.next()).intValue();
int z = ((Integer) g.next( )).intValue();
if (z > mass) mass = z; }
anche qui si usa il metodo overriden del supertipo
- oltre ai metodi ereditati size e elements