Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class DemoQueue4 {
- public static void main(String[] args) {
- System.out.print("Demo Queue - versión librería estándar - Caso Ejemplo b)\n");
- SpecialQueue<Integer> queue1 = new SpecialQueue<Integer>();
- Random random = new Random();
- int number;
- System.out.print("Enqueuing...\n");
- for (int c = 0; c < 10; ++c) {
- queue1.add(number = random.nextInt(11));
- System.out.printf("%d ", number);
- }
- System.out.print("\n");
- System.out.print("Joining with same queue...\n");
- SpecialQueue<Integer> queue2 = queue1.join(queue1);
- System.out.print("Dequeuing...\n");
- while (queue1.size() > 0) {
- System.out.printf("%d ", queue1.remove());
- }
- System.out.print("\n");
- System.out.print("Dequeuing joined queue...\n");
- while (queue2.size() > 0) {
- System.out.printf("%d ", queue2.remove());
- }
- System.out.print("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement