Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Debugging Help for LinkedDequeue

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what I am doing wrong. I am assuming the issue is coming from the removeLast method
LinkedDequeue.png
[Thumbnail for LinkedDequeue.png]
 
Marshal
Posts: 25963
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

John Luxbrand wrote:I am not sure what I am doing wrong.



What makes you think you are doing something wrong?
 
John Luxbrand
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

John Luxbrand wrote:I am not sure what I am doing wrong.



What makes you think you are doing something wrong?



the error message in the attached photo
 
Paul Clapham
Marshal
Posts: 25963
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. So the stack trace says the error is at line 120 in your code. It's hard to tell what line that is here, because you've chopped off the first few lines of your class. So which line is line 120?
 
John Luxbrand
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:Okay. So the stack trace says the error is at line 120 in your code. It's hard to tell what line that is here, because you've chopped off the first few lines of your class. So which line is line 120?


 
John Luxbrand
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

John Luxbrand wrote:

Paul Clapham wrote:Okay. So the stack trace says the error is at line 120 in your code. It's hard to tell what line that is here, because you've chopped off the first few lines of your class. So which line is line 120?



So to precise on the issue, I got it to properly check if the queue is empty and display the proper amount of items in the queue, however, the issue arises when i get to the test part where it removes last/first and writes it back out.
DequeExpected.png
expected output
expected output
LinkedDequeue.png
My output
My output
 
Marshal
Posts: 7791
536
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lines 119; 120
Potentially last here is null.
 
Liutauras Vilda
Marshal
Posts: 7791
536
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you posted not in the beginners forum, why you don't write unit tests so you could verify each and every method?

I didn't look at whole code flow.. but your goal is to narrow down the problem and replicate scenario which would be easy to understand.
 
Whatever. Here's a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic