- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuiltInQueue.java
More file actions
Latest commit
18 lines (14 loc) · 560 Bytes
/
Copy pathBuiltInQueue.java
File metadata and controls
18 lines (14 loc) · 560 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
packagecom.sarvesh.javabasics;
importjava.util.LinkedList;
importjava.util.Queue;
publicclassBuiltInQueue {
publicstaticvoidmain(String[] args) {
Queue<Integer> driveThru = newLinkedList<>();
driveThru.offer(100);
driveThru.offer(200);
driveThru.offer(300);
System.out.println("Car at the window: " + driveThru.peek());
System.out.println("Served and left: " + driveThru.poll());
System.out.println("Next car at the window: " + driveThru.peek());
}
}