Luke Stamper

Ranch Hand
+ Follow
since Jun 19, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Luke Stamper

Well, I don't think one can fully understand doublylinked lists until they force themselves to understand them until they 'actually' understand them.

In any case, for anyone following this entirely too long of a thread, here is my working code



6 years ago
How about this?




Do I also have to add something to actually print the nodes in the displayItem() method?

Such as...

6 years ago
I think I have a better handle on my doublylinked list now...although I am experiencing a few errors still...

I am not sure if I should use the list or iterator before outputBackwards in linkedlist3demo class.

Am I on the right track with my outputBackwards method?

--------------------Configuration: <Default>--------------------
G:\Object Java\LinkedList3.java:217: error: ';' expected
return T position;
^
G:\Object Java\LinkedList3.java:217: error: not a statement
return T position;
^
G:\Object Java\LinkedList3.java:217: error: cannot find symbol
return T position;
^
symbol: variable T
location: class LinkedList3<T>
where T is a type-variable:
T extends Object declared in class LinkedList3
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors

Process completed.

6 years ago
I chaned my addToStart method to include the tail.

6 years ago
I figured since I have TwoWayNode tail = current, that sets the current node to the tail, meaning the tail is not null.
6 years ago
So I need to add the tail to addToStart?
6 years ago
I've been staring at this for way too long.

It's not the loop. The tail is not null so it should go through the loop and print.

There is something wrong with the displayLink method. Something with the passing of arguments?
6 years ago
I have to pass the current data item into the print output to print the current item and then each additional item.
6 years ago
I don't have the link value anywhere.

I am not instructing my program to print the correct thing.
6 years ago
I don't see why this method isn't working? I start at the tail, then display data until start of list moving to each link.

6 years ago
This still prints it in order. Ugh.

6 years ago
It will always be null.

This is all I know about what I have to do....keep track of the tail and add a method outputBackwards to prove the list is doubly linked.
6 years ago
So it appears my outputBackwards method doesn't outputBackwards at all, it just outputs the list as is. Can anyone tell me why that is?

Also, i've gotten rid of the insertAfter method.
6 years ago
Does anything about those two methods look correct?
6 years ago
So my outputBackwards and insertAfter methods aren't working.

And yes, this is my code. I wrote it with the help of my java tutor.


6 years ago