Queuenames = new LinkedList<>(); names.add("Alice"); names.add("Bob"); names.add("Charlie");
String first = names.poll(); System.out.println(first); // Alice
String top = names.peek(); System.out.println(top); // BobIn this example, we used the java.util package library and implemented a queue using the LinkedList class.