import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue; public class ConQueue { public static void main(String[] args) { ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue(); queue.offer("呵呵"); System.out.println("offer 后,队列是否空"+queue.isEmpty()); System.out.println("从对垒中poll"+queue.poll()); System.out.println("poll 后,队列是否空"+queue.isEmpty()); } }
offer 后,队列是否空false
从对垒中poll呵呵
poll 后,队列是否空true
原文:https://www.cnblogs.com/hshy/p/14070963.html