Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there an easier way?