public void enqueue (Object o, int priority) { boolean key = false; if(!this.isEmpty()) { this.setFirst(); //while current value is not null check while (this.currValue() != null && key != true) { if(priority >= this.currPriority()) { if (priority >0) { if (priority == this.currPriority()) { while(this.currPriority() == priority) { this.next(); } this.insert(o, priority); key = true; } else { this.insert(o, priority); key = true; } } else { this.insert(o, priority); key = true; } } if (priority != this.currPriority()) this.next(); } } else { this.insert(o,priority); } }