Queue<String> q2 = new ArrayDeque<>(); q2.add("刷牙"); q2.add("吃早餐");
Queue<String> q3 = new ArrayDeque<>(); q3.add("打包午餐");
List<String> taskExeList = new ArrayList<>(); // 初始任务是起床 taskExeList.add("起床");
List<Queue<String>> queueList = new ArrayList<>(); queueList.add(q1); queueList.add(q2); queueList.add(q3); Random random = new Random(); while (!queueList.isEmpty()){ int i = random.nextInt(queueList.size()); Queue<String> taskQueue = queueList.get(i); taskExeList.add(taskQueue.poll()); if(taskQueue.isEmpty()){ queueList.remove(i); } }