package Queue;public class LnodeQueue {private Lnode head;private Lnode tail;public LnodeQueue() {head = new Lnode();tail = head;}public void enQueue(String name) {Lnode temp = new Lnode(name);tail.next = temp;tail = temp;}public void delQueue() {if (head.next == null) {System.out.println("队列为空");return ;}if (head.next == tail) {tail = head;}head.next = head.next.next;}public void display(){if (head.next == null) {System.out.println("队列为空");return ;}for(Lnode temp=head.next;temp!=null;temp=temp.next){System.out.print(temp.stu.name+" ");}System.out.println("本次打印完成。");}public int len(){int length=0;for(Lnode temp=head.next;temp!=null;temp=temp.next){length++;}if(length!=0){return length;}return -1;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。