多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
**Java内置的队列库** ``` public class Main { public static void main(String[] args) { // 1. Initialize a queue. Queue<Integer> q = new LinkedList(); // 2. Get the first element - return null if queue is empty. System.out.println("The first element is: " + q.peek()); // 3. Push new element. q.offer(5); q.offer(13); q.offer(8); q.offer(6); // 4. Pop an element. q.poll(); // 5. Get the first element. System.out.println("The first element is: " + q.peek()); // 7. Get the size of the queue. System.out.println("The size is: " + q.size()); } } ```