public void enqueue(Skill skill) { if (firstInQueue==null) { firstInQueue = skill; } else { if (firstInQueue.getPriority() < skill.getPriority()) { skill.setNextSkill(firstInQueue); firstInQueue = skill; } else { firstInQueue.enqueue(skill); } } }
public void enqueue(Skill skill) { if (nextSkill == null) { nextSkill = skill; } else { if (nextSkill.getPriority() < skill.getPriority()) { skill.setNextSkill(nextSkill); nextSkill = skill; } else { nextSkill.enqueue(skill); } } }