public Key max() { if (size == 0) { return null; } else { Key maximum = list.getFirst(); for (Key p : list) { if (p.compareTo(maximum) == 1) maximum = p; } return maximum; } }
public Key delMax() { Key qurrentMax = list.pop(max); size--; max = this.max(); return qurrentMax; }
public void insert(Key key) { list.push(key); size++; max = this.max(); }