Online Java Compiler By
JavaTpoint.com
import java.util.Spliterator; import java.util.concurrent.LinkedTransferQueue; class Information { String rollNo, name; int age; public Information(String rollNo, String name, int age) { this.rollNo = rollNo; this.name = name; this.age = age; } } public class LinkedTransferQueueSpliteratorMethodExample3{ static int i=1; public static void main(String[] args) { LinkedTransferQueue
queue = new LinkedTransferQueue(); Information val1 = new Information("15cs1029","Johnson",24); Information val2 = new Information("15cs1012","Harry Potter",22); Information val3 = new Information("15cs1011","John",21); queue.add(val1); queue.add(val2); queue.add(val3); Spliterator
str = queue.spliterator(); while(str.tryAdvance((n)->System.out.println(i++ +" Roll No = "+n.rollNo +"\n Name = "+n.name +"\n Age = "+n.age+"\n"))); } }
Output