aspose file tools*
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
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: 24187
    
  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