The toString() method of LinkedBlockingDeque returns a string representation of this collection. The string representation consists of a list of the collection’s elements in the order they are returned by its iterator, enclosed in square brackets (“”). The adjacent elements are separated by the characters “, “ (comma and space). The elements are converted to strings as by String.valueOf(Object).
public String toString()
Parameters: This method does not accept any parameters.
Returns: This method returns a string representation of this collection.
Below programs illustrate toString() method of LinkedBlockingDeque:
Linked Blocking Deque: [7855642, 35658786, 5278367, 74381793] LBD in string [7855642, 35658786, 5278367, 74381793]
Linked Blocking Deque: [geeks, sudo, gate, gopal] LBD in string [geeks, sudo, gate, gopal]
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.