public void enqueue(TypeValue val, int prio) {
        QueueElement current = head;
        while (current.getNext() != null && current.getNext().getPrio() < prio) {
            current = current.getNext();
        }
        QueueElement tmp = new QueueElement(val, prio);
        tmp.setNext(current.getNext());
        current.setNext(tmp);
    }