Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Print an ArrayList in different format?

840446Mar 30 2011 — edited Apr 2 2011
Is there any easy tricks to printing an ArrayList in a different format? Or do I have to make a for loop to iterate through the List?

Output:
[
Motherboard, Manufacturer = asus, Price = 50.0, Order Number = 1, 
Motherboard, Manufacturer = hp, Price = 50.0, Order Number = 1, 
Motherboard, Manufacturer = sony, Price = 50.0, Order Number = 1, 
RAM, Manufacturer = Rammy, Price = 50.0, Order Number = 1, 
RAM, Manufacturer = atari, Price = 50.0, Order Number = 1]
I would like to remove the square brackets and also the commas and line everything up in columns. Any easy way to do that? I probably have to make a for loop right?
This post has been answered by TPD-Opitz on Mar 30 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2011
Added on Mar 30 2011
35 comments
2,356 views