CodePudding user response:
You this is called the object's toString dozen outThe ArrayList toString is
You can write a loop to print the content in the ArrayList
CodePudding user response:
Arraylist. Stream (). The foreach (System. Out: : println)CodePudding user response:
The set, the get methodCodePudding user response:
Piss me off, on talent!!!!!ListList=Arrays. AsList (1, 2, 3, 4, 5);
System. Out. Println (list);
This print will be one line of output, its output is a list the object's toString (), you can't modify the list of the toString () code, so it is the output of one line, want to solve, you can write a class inherits ArrayList, covering its toString (), and then modified into the properties of line joining together string can,
Another solution is to iterate through the collection, and then wrap the output each element, if you are using JDK is above 1.8, use the following this simple code
ListList=Arrays. AsList (1, 2, 3, 4, 5);
List. The forEach (System. Out: : println);