This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Is there an easier way? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there an easier way?" Watch "Is there an easier way?" New topic
Author

Is there an easier way?

Eric Ahn
Greenhorn

Joined: Dec 19, 2007
Posts: 2
I want to print a list where each node references the next node backwards, and then include a new line, but I can't think of a way to include outputting the new line as part of the original printBackward method. If there is an easier way, what it is?


[ December 19, 2007: Message edited by: Eric Ahn ]
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Easier - probably not. But if you want to do it in one method, how about this?



Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Eric Ahn
Greenhorn

Joined: Dec 19, 2007
Posts: 2
Yeah, I wanted it to be in one method. Thanks!
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I possibly should have pointed out that the reason for the varargs (...) stuff is so you can still call printBackwards() with just one argument. Only the internal call should use two arguments.
 
Have you checked out Aspose?
 
subject: Is there an easier way?
 
jQuery in Action, 3rd edition