Question: Starting with the LinkedStringLog class we implemented in class, edit the class to be generic. package stringLog; public class LinkedStringLog implements StringLogInterface { protected LLStringNode
Starting with the LinkedStringLog class we implemented in class, edit the class to be generic.
package stringLog;
public class LinkedStringLog implements StringLogInterface
protected LLStringNode first null;
protected LLStringNode foundElement null;
protected int count ;
@Override
public void insertString element
LLStringNode node new LLStringNodeelement;
node.setNextfirst;
first node;
count;
@Override
public boolean containsString element
LLStringNode node first;
whilenode null && foundElement null
ifnodegetDataequalsIgnoreCaseelement
foundElement node;
node node.getNext;
return foundElement null;
@Override
public void removeString element
iffirst null && first.getDataequalsIgnoreCaseelement
first first.getNext;
count;
else ifcontainselement
LLStringNode node first;
whilenodegetNext foundElement
node node.getNext;
node.setNextfoundElementgetNext;
foundElement null;
count;
@Override
public int Size
int count ;
LLStringNode node first;
whilenode null
count;
node node.getNext;
return count;
@Override
public void clear
first null;
@Override
public boolean isEmpty
return first null;
@Override
public boolean isFull
return false;
@Override
public String toString
String result "String Log;
;
LLStringNode node first;
int count ;
whilenode null
result count node.getDatan;
node node.getNext;
count;
return result;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
