Course Solutions Uncategorized (Solved) : Java Assume Want Add New Method Public T Getlastmatch T Anentry Linkedbag Class Method Ret Q36418536 . . . .

(Solved) : Java Assume Want Add New Method Public T Getlastmatch T Anentry Linkedbag Class Method Ret Q36418536 . . . .

 

Java.

Assume you want to add a new method public TgetLastMatch(T anEntry) to LinkedBagclass. The method returns a reference to the last data in a bagthat matches anEntry. If there is nomatch data, this method returns null. Note: assumefirstNode is a private data field inlinked list which references to first node.

Example: Let myBag contains stringobjects: “world”, “world”, “hello”, “world”,”abc”.
  myBag.getLastMatch(“world”)returns a reference to the 4th data“world” in the bag.

public T getLastMatch(T anEntry)
{  //write your statements here. You may access data fieldsfirstNode here.

}  // end of method

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post