Question: Please complete this with comments and pseudo code. (in Java) This was answered on Chegg here: https://www.chegg.com/homework-help/questions-and-answers/using-generic-capabilities-java-50-modify-implementation-structure-singlylinkedlist-presen-q16261235 If it's correct please add pseudo code for
Please complete this with comments and pseudo code. (in Java)
This was answered on Chegg here: https://www.chegg.com/homework-help/questions-and-answers/using-generic-capabilities-java-50-modify-implementation-structure-singlylinkedlist-presen-q16261235
If it's correct please add pseudo code for it.
Using the generic capabilities of Java 5.0, modify the implementation of the structure SinglyLinkedList presented in Figure 4.15 to make it fully generic. Include a driver program that demonstrates the functionality of the class with two homogeneous SinglyLinkedList objects that store two different kinds of nodes.

1. public class SinglyLinkedList 2. private Node h; list header public SinglyLinkedList) { h new Node(); // dummy node 6 h,next = null public boolean insert (Listing newListing) { Node n = new Node(); if(n null) // out of memory roturn false else 12 13 { n.next =h.next ; h, next = n; n.1 = newLi sting. deepCopy(); return true; 15 17 18 public Listing fetch (String targetKey) { Node p = h.next; 21. && l(p. 1 . compareTo (target Key) 0)) while (p |s null { p=p.next; = 23 24 25 26 27. 28 29. 30, if(p 1= null) return p.l.deepCopyO; else return null: public boolean deleto (String targetKey) { Node q=h; Node p = h.next; while (p != null && 32 ! (p. 1 . compareTo(targetKey) 0)) == 34 35 36 37. 38 39 40 41 p = p.next; 1= q.next if(p null) p,next; = return true: else return false 43 public boolean update (String targetKey, Listing newListing) if(delete(targetKey)false) 44. 45 46 47 48 49 return false else if(insert (newl isting) = false) roturn false; return true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
