package Stack;public class Mian {public static void main(String[] args) {ListLNode list = new ListLNode();addStudent(list);sequenceStack seStack=new sequenceStack();LNodeStack LStack=new LNodeStack();for(LNode temp=list.head.next;temp!=null;temp=temp.next){if(temp.stu.isBoy){seStack.push(temp.stu);}else{LStack.push(temp.stu);}}for(int i=0;i<5;i++){dancing(seStack, LStack);}}/*** @param list*/private static void addStudent(ListLNode list) {Student s1 = new Student("旺财", true);Student s2 = new Student("Joe", false);Student s3 = new Student("小强", true);Student s4 = new Student("Alice", false);Student s5= new Student("张三", true);Student s6 = new Student("Rose", false);Student s7 = new Student("李四", true);Student s8 = new Student("Jan", false);Student s9 = new Student("王五", true);Student s10 = new Student("Lisa", false);list.insert(s1);list.insert(s2);list.insert(s3);list.insert(s4);list.insert(s5);list.insert(s6);list.insert(s7);list.insert(s8);list.insert(s9);list.insert(s10);}private static void dancing(sequenceStack seStack, LNodeStack lStack) {String boy=seStack.pop();String girl=lStack.pop();System.out.println(boy+" "+girl+"已出栈跳舞。");}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。