For the first error, you are trying to assign ob
a value of ob.next
. ob
is a Node
, but ob.next
is an Item
. Obviously, an Item
is not a Node
, so you can't assign an Item
to a Node
.
The same thing applies on the line:
first.next = oldfirst;
first.next
is an Item
, but oldFirst
is a Node
. You can't assign a Node
to a variable of type Item
.
For the error cannot find symbol symbol:class Itertor
. That is because you need to put this at the very top of your code:
import java.util.Iterator;
On the line:
return IndepentRandomIterator();
The code attempts to call the method IndepentRandomIterator()
. To make it call the constructor for the IndepentRandomIterator
class, you need to add the keyword new
right before IndepentRandomIterator()
like this:
return new IndepentRandomIterator();
For your error on this line:
ob.next.last = temp;
The code attempts to access the field last
of the object ob.next
. I think you want to access the object ob.last
. That will still be a problem, though, because then you will get the first error. Both ob.next
and ob.last
are of the type Item
, but temp
is a Node
.
Near the end of your code, you try to use StdOut.println()
. StdOut
does not exist; you should use System.out.println()
.