Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedTransferQueue; public class LinkedTransferQueueRemoveExample2 { public static void main(String[] args) { List list1 = new List("Cake"); List list2 = new List("Candle"); List list3 = new List("Knife"); List list4 = new List("Matchbox"); List list5 = new List("Cap"); List list6 = new List("Stricker"); LinkedTransferQueue
queue = new LinkedTransferQueue
(); queue.add(list1); queue.add(list2); queue.add(list3); queue.add(list4); queue.add(list5); queue.add(list6); for (List xyz:queue){ System.out.println(xyz); } queue.remove(list4); queue.remove(list1); System.out.println("New List : "+queue); } } class List{ String birthday_item; public List(String birthday_item) { this.birthday_item = birthday_item; } public String toString(){ return this.birthday_item; } }
Output