X345: lastNodeParam5

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
List L has a reference to the first node. Write code that returns the reference to the last node in list L whose data equals the parameter. Make sure to account for edge cases!

Initial Setup Final Configuration

Examples:

lastNodeParam(Link.CreateList(1,2,3,3),3) -> Link.CreateList(3)
Reset
Visualize

Practice a different Java exercise