• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Iterate Over LinkedList

 
Ranch Hand
Posts: 1938
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to iterate over a linked list but have not got it to work. Compile error on the 'For' line.

My code:

 
Saloon Keeper
Posts: 3304
146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Steve,

that is because you are using the raw (non-generic) version of LinkedList. Try using

and all should be well.
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Marshal
Posts: 64705
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid your pseudocode isn't quite accurate, since you have a second loop which you didn't acknowledge with loop... endLoop... tags.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!