I'm making a wrapper to queue type, but each time I add element, I want to sort everything inside. Mostly it will be Integer. I'm not too familiar with Collections framework, is there any simple solution ?
public class Round<Type> {
private Queue<Type> qe;
public Round(){
this.qe = new LinkedList<Type>();
}
public void push(Type p){
this.qe.offer(p);
//Collections.sort(this.qe); Here I want to sort this
}
public Type pop(){
return this.qe.poll();
}
}