Online Java Compiler By
JavaTpoint.com
import java.util.Collections; import java.util.concurrent.LinkedTransferQueue; public class LinkedTransferQueueAddExample2 { public static void main(String[] args) { Integer[] val = {0, 1}; LinkedTransferQueue
queue = new LinkedTransferQueue
(); queue.add(718); queue.add(8); queue.add(18); queue.add(119); System.out.println("Queue : "); for (Integer n : queue) { System.out.println(n); val[0] = Collections.max(queue); val[1] = Collections.min(queue); } System.out.println("Max number = "+ val[0]); System.out.println("Min number = "+ val[1]); } }
Output