This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes linked list problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "linked list problem" Watch "linked list problem" New topic
Author

linked list problem

Pepo moussa
Ranch Hand

Joined: Mar 20, 2008
Posts: 36
hello i got a problem with this method which should read txt file and insert it into unsorted lined list but every time i try to print the list it give me empty list ,i tried the append method and it works fine ..so anyone can help.



Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Since "RoomUnsortedList" is not a standard class, I can't be sure, but I think your problem is here:


while ( i < list.getLength() && line != null )


since "i" starts at zero, and I'll assume "list" starts out empty, this loop condition is false the first time, and so no append() calls are ever made.


[Jess in Action][AskingGoodQuestions]
Pepo moussa
Ranch Hand

Joined: Mar 20, 2008
Posts: 36
well you were right...i feel so stupid now :S lol anyway thank you
[ April 01, 2008: Message edited by: I moussa ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: linked list problem
 
Similar Threads
FileReader / BufferedReader will only read the first line from the file
File Upload using JSP
getting text to appear in the JOptionPane function
Circular List
actionPerformed in frame problem