• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

list ADTs

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
been having a problem which for the life of me i can't figure out. The assignment requires the use of a doubly linked list ADT, but i keep getting a NullPointerException which i don't understand, chances are its something silly which i'm just not seeing well at least i hope it is. Heres what i've got, i've tracked the bug to the insertAfterCurrent() method, there are other methods that might have problems aswell and some that are downright silly, but one step at a time.

thanks for any help
later
y'all.
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should post a short piece of client (testing) code that demonstrates the problem.
-Jeff-
 
tom eustace
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, i should have done so before. so here is some test code that throws the NullPointerException.

For my assignment i need to be able to create possible many lists and manipulate them. Hence this line which i think is where the problem starts
but the debugger points to the insertAfterCurrent() method and the second.setPrev(after_current); line specifically.
once again thanks for any halp
t
 
Jeff Langr
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think in your test you don't want to advance after an insertion:

And offEnd seems like it should be:

-Jeff-
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic