从队列开头删除与时间有关的内容

时间:2018-09-20 02:16:45

标签: java time stack

如果我有someObject

public class someObject 
{
	String objName;
	int removeTime;
	//---------------------------------------
	//Constructor
	public someObject(String objName, int removeTime)
	{
		this.objName = objName;
		this.removeTime = removeTime;
	}
        //---------------------------------------
}

main过去之后,我想在Queueremove()中添加一些这些对象。

removeTime

相对于import java.util.*; public class App { public static Queue<someObject> s = new LinkedList<someObject>(); //--------------------------------------------------------------- public static void main(String[] args) { s.add(new someObject("Harry", 10)); s.add(new someObject("Jimmy", 5)); s.add(new someObject("Tim", 2)); //print s.remove() if time(seconds) == s.peek().removeTime //print full remaining } //--------------------------------------------------------------- },从队列中实现remove()的功能的最佳方法是什么?

0 个答案:

没有答案