Online Java Compiler By
JavaTpoint.com
import java.util.Iterator; import java.util.concurrent.LinkedTransferQueue; public class LinkedTransferQueueIteratorExample1 { static int i = 1; public static void main(String[] args) { LinkedTransferQueue
queue = new LinkedTransferQueue
(); queue.add("Jackson"); queue.add("Harry"); queue.add("John"); queue.add("Honey"); Iterator
iterator = queue.iterator(); //Returns an iterator over the elements while (iterator.hasNext()) { System.out.println(i++ + "." + iterator.next()); } } }
Output