Question: In Java Please!! The starter project provides a basic implementation of the LList class, including the Node inner / private class. Your task is to
In Java Please!!
The starter project provides a basic implementation of the LList class, including the Node innerprivate
class. Your task is to complete the following methods:
indexOfint value: Returns the index of the first occurrence of the specified value in the list.
Note: The list uses based indexing, so the first element is at index not index If the value is
not found, return
reverse: Reverses the order of elements in the list.
removeDuplicates: Removes duplicate values from the list, leaving only unique elements in their
firstoccurrence order.
Grading Rubric
public class GradingRubric
public static void mainString args
int score ;
LList list new LList;
list.add;
list.add;
list.add;
list.add;
list.add;
list.add;
System.out.printOriginal List: ;
list.printlist;
Test Case : Testing indexOf
System.out.println
Test Cases for indexOf:";
score runTestCaselistindexOf "indexOf should return ;
score runTestCaselistindexOf "indexOf should return first occurrence;
score runTestCaselistindexOf "indexOf should return not found;
Test Case : Testing add
System.out.println
Test Cases for add:";
list.add;
score runTestCaselistindexOf "add indexOf should return ;
list.add;
score runTestCaselistindexOf "add indexOf should return ;
list.add;
score runTestCaselistindexOf "indexOf should still return first occurrence;
Test Case : Testing reverse
System.out.println
Test Cases for reverse:";
list.reverse;
score runTestCaselistindexOf "After reverse, indexOf should return ;
score runTestCaselistindexOf "After reverse, indexOf should return ;
list.reverse;
score runTestCaselistindexOf "After second reverse, indexOf should return ;
score runTestCaselistindexOf "After second reverse, indexOf should return ;
list.printlist;
System.out.printlnlistgetLength;
Test Case : Testing removeDuplicates
System.out.println
Test Cases for removeDuplicates:";
list.removeDuplicates;
score runTestCaselistindexOf "After removeDuplicates, indexOf should return ;
score runTestCaselistindexOf "After removeDuplicates, indexOf should return ;
score runTestCaselistindexOf "After removeDuplicates, indexOf should return ;
score runTestCaselistgetLength "After removeDuplicates, size should be ;
score runTestCaselistindexOf "After removeDuplicates, indexOf should return ;
Test Case : Testing isEmpty and clear
System.out.println
Test Cases for isEmpty and clear:";
score runTestCaselist.isEmpty "List should not be empty";
list.clear;
score runTestCaselistisEmpty "List should be empty after clear";
Test Case : Testing size and adding elements after clear
System.out.println
Test Cases for size and adding elements after clear:";
score runTestCaselistgetLength "After clear, size should be ;
list.add;
list.add;
score runTestCaselistgetLength "After adding two elements, size should be ;
list.add;
list.add;
score runTestCaselistgetLength "After adding two elements, size should be ;
Final Score Display
System.out.println
Total Score: score ;
Utility method for running individual test cases
public static int runTestCaseboolean passed, String description
if passed
System.out.printlnPassed points description;
return ;
else
System.out.printlnFailed description;
return ;
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
