budget/src/main/java/budget/backend/structures/BinaryTreeHeap.java
protected void add(K key, V value) throws NullPointerException{
		try {
			// the the tree is empty, initialise a new tree
			if (isEmpty()) {
				root = new BinaryTreeNode<K, V>(key, value);
				// reset the root of the superclass
				super.root = root;
				last = root;
			}
			// add new node to the last element, find new last and sort the tree again
			else {
				findNext();
				last.setKey(key);
				last.setValue(value);
				upHeap(last);
			}
			size++;	
		} 
		catch (NullPointerException e) {
			throw e;
		}
	}
/** Definition of the abstract method in the superclass. Only to be used by insert */
Definition of the abstract method in the superclass. Only to be used by insert
Definition of the abstract method in the superclass . Only to be used by insert
protected void add(K key, V value) throws NullPointerException{
		try {
			if (isEmpty()) {
				root = new BinaryTreeNode<K, V>(key, value);
				super.root = root;
				last = root;
			}
			else {
				findNext();
				last.setKey(key);
				last.setValue(value);
				upHeap(last);
			}
			size++;	
		} 
		catch (NullPointerException e) {
			throw e;
		}
	}
protected void add ( K key , V value ) throws NullPointerException { try { if ( isEmpty ( ) ) { root = new BinaryTreeNode < K , V > ( key , value ) ; super . root = root ; last = root ; } else { findNext ( ) ; last . setKey ( key ) ; last . setValue ( value ) ; upHeap ( last ) ; } size ++ ; } catch ( NullPointerException e ) { throw e ; } }
Definition of the abstract method in the superclass.
Definition of the abstract method in the superclass .
// the the tree is empty, initialise a new tree // reset the root of the superclass // add new node to the last element, find new last and sort the tree again