Пример #1
0
 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;
   }
 }
Пример #2
0
 public Key delMax() {
   Key qurrentMax = list.pop(max);
   size--;
   max = this.max();
   return qurrentMax;
 }
Пример #3
0
  public void insert(Key key) {

    list.push(key);
    size++;
    max = this.max();
  }