LinkedTransferQueue toString() method in Java with Examples
The toString() method of java.util.concurrent.LinkedTransferQueue is an in-built function is Java which is used to return the string representation of the collection. The String representation consists of the elements of the collection enclosed in “” and separated by “, “. The order of elements in the spring representation appear in the order of their iteration.
public String toString ()
Parameters: This method do not accepts any parameter.
Return Value: This method returns a string representation of the collection containing the elements in the same order.
Exceptions: No Exceptions are present.
Below program illustrates the toString() function of LinkedTransferQueue class :
String Representation: [101, 202, 58, 796, 641]
String Representation: [GeeksforGeeks, Gfg, gfg, Geeks, geeks]
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.