Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

linked list problem

 
Pepo moussa
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pepo moussa
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well you were right...i feel so stupid now :S lol anyway thank you
[ April 01, 2008: Message edited by: I moussa ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic