Question
package hw6; import java.util.NoSuchElementException; public class MyList { private class MyListNode { public Item item; public MyListNode next; public MyListNode(Item i, MyListNode n) { item
package hw6;
import java.util.NoSuchElementException;
public class MyList
/** * Returns the data in position {@code index} in the list. * Note that like arrays the first data item is in position 0. * @param index the index of the item to get from the list * @throws NoSuchElementException if the list doesn't have a * position {@code index} * @return the data in position {@code index} in the list. */ public Item get(int index) { // TODO return null; }
/** * Constructs a separate copy of a list. Changes to the copy do not affect the original. * @return a copy of the list */ public MyList
/** * Constructs a {@code String} representation of the list. The {@code String} * is a comma separated listing of the {@code String} representations of the items * in the same order they appear in the list. There are no spaces between items. * @return a {@code String} representation of the list. */ public String convertToString() { // TODO return null; } /** * Deletes the first occurrence of {@code target} from the list if it is present. * Does nothing if {@code target} is not present. * * @param target the item to be deleted */ public void delete(Item target) { //TODO } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started