Question: In the implementation, all your code must be contained in StringLinkedList.java and not use any Java collection classes (e.g., ArrayList, LinkedList, etc). The linked list

In the implementation, all your code must be contained in StringLinkedList.java and not use any Java collection classes (e.g., ArrayList, LinkedList, etc). The linked list treats indices like an array: 0 represents the first element in the list, 1 the second element, and so on.

Do not put package statements in your code.

All of your code must reside within StringLinkedList.java. This is all that you will submit.

Do not delete any methods, rename any methods, change public to private, or change parameter lists. If you are not sure how to implement a method, leave the method as a stub (header plus return statement).

You may add private methods as you see fit.

You may not add any additional data members to the class definition.

The main method that is provided to you must compile with your code.

The bold methods shown below must contain exactly the source code provided in the instructional videos.

 In the implementation, all your code must be contained in StringLinkedList.javaand not use any Java collection classes (e.g., ArrayList, LinkedList, etc). Thelinked list treats indices like an array: 0 represents the first elementin the list, 1 the second element, and so on. Do notput package statements in your code. All of your code must residewithin StringLinkedList.java. This is all that you will submit. Do not deleteany methods, rename any methods, change public to private, or change parameter

import java.util.ArrayList; import java.util.NoSuchElementException; import java.util.Set; public class StringLinkedlist { // Keep everything public. public class Node { public String data; public Node next; public Node (String data) this.data - data; this.next = null; } public Node (String data, Node, next) { this.data = data; this.rext next; } } public Node head; public int numItems; * Creates the empty list. */ public StringLinkedList() { } * Creates a list containing all the elements of the passed array + {@code data [01} will be the first element of the list, {@code data (11) will * be the second element of the list, and so on. @param data The array of values @throws NullPointerException - data is null public StringLinkedList(String[] data) { String [] ary1 = ("A", "B", "C"}; } * Constructs a deep copy of the linked list {@code original}. A deep copy is produced when each linked list has its own structures that contain the same values. For example, String[] ary1 = {"A", "B", "C"}; String[] ary2 = aryl, aryl and ary2 share the array structure, whereas, the following produces a different structure with identical values: String[] ary1 = {"A", "B", "C"}; String [] ary2 = Arrays.copyof (aryl); @param original The list to be copied * @throws NullPointerException - original is null + public StringLinkedlist(StringLinkedList original) } * Returns array with all the elements. * @return Array containing all elements. public String[] toArray () { return null; } * Formats the elements in the list using leading and ending brackets (i.e., + []), with the values comma separated. There will be no intervening spaces. * Some examples: {@code []} (@code [hellol} {@code [hello, world, everyone, !]} @Override public String toString() return null; } /** * Returns the number of items in the list * @return Number of items in the list public int size () { return 0; } /** * Determines if two lists contain exactly the same values, in exactly the same order. @return {@code true} if and only if obj is an list that is equivalent to the incoming list. */ public boolean equalslinkedList(StringLinkedList obi) return false; } /** * Determines if code key) is in the linked list. + * @param key The value to be found * @return true if and only if {@code key) is in the list / public boolean contains (String key){ return false; } * Determines the index of {@code key}. -l is returned if the value is not * present in the linked list. If (@code key) is present present more than once, * the first index is returned. * @param key The value to be found * @return The index of the code key} */ public int indexOf(String key) { return 0; } * Returns the value of the first element of the list. @return The first element of the list. @throws NoSuchElementException the list is empty */ public String getFirst() { null; } /** + Returns the value of the last element of the list. * @return the last element of the list. + @throws NoSuchElementException the list is empty public String getLast() { return null; } /** * Returns the value of the (@code ith} element of the list (0 based). @param i The target index @return The value of the ith element of the list. * @throws IndexOutOfBoundsException (code i} is illegal */ public String getAt (int i) { return null; } /** * Adds (@code data) to the beginning of the list. All other values in the list remain but they are "shifted to the right." * @param data The value to add to the list A public void insertFirst(String data) } * Adds {acode data to the end of the list. All other values in the list remain in their current positions. * @param data The value to add to the list public void insertLast(String data) { } /** * Adds data to a specific spot in the list. The values in the list remain * intact but {@code data} is inserted in the list at position {@code i}. When {@code i=0}, the result is the same as (@code insertFirst}. @param i The target index @param data The value to add to the list @throws IndexOutOfBounds exception { code i} is illegal public void insertAt(int i, String data) { } Adds (code newData} the position immediately preceding {@code existingData). * If the {@code existingData} appears multiple times, only the first one is + used. * @param newData The value to add to the list * @param existingData The value used to control where insertion is to take place * @throws NoSuchElementException {@code existingData) is not in the list * public void insertBefore(String newData, String existingData) 1 } * Adds {@code newData} the position immediately after {@code existingData}. If * the (@code existingData} appears multiple times, only the first one is used. @param newData The value to add to the list * @param existingData The value used to control where insertior is to take place throws NoSuchElementException {@code existingData) is not in the list */ public void insertAfter (String newData, String existingData) { } * Removes the first element of the list. The remaining elements are kept in * their existing order. * @return The value removed from the list * @throws NoSuchElementException if the list is empty. * public String removeFirst() { return null; } /** * Removes the last element of the list. The remaining elements are kept in their existing order. @return The value removed from the list @throws NoSuchElementException if the list is empty. */ public String removeLast() { re null; } * Removes the ith element of the list. The remaining elements are kept in their # existing order. * @param i The target index * @return The value removed from the list * @throws IndexOutOfBounds Exception i does not represent a legal index public String removeAt(int i) { return null; } Removes the first occurrence of data in the linked list. @param data The value to be removed. @return {@code true} if and only if {@code data was removed */ public boolean removeFirstOccurrenceof (String data) { return false; } /** * Removes the all occurrence of code data in the linked list. * @param data The value to be removed. * @return. The number of times { @code data} was removed * public int removeAl10ccurrencesof(String data) { return 0; } * Reverses the elements in the linked list. public void reverse() { } * Sets all the elements in the list to uppercase. */ public void toupper() { } /** Returns the strings (there might be a tie) that appear most frequently in the list. Some examples: * A, D, D, A, B, B, C, D, A should return the set {A and D] * since there re three copies of each (A, B, C) should return the set {A, B, C} since there are one copies of each * @return Set of strings that appear most frequently. + public Set getMost Frequent() { return null; } /** * Returns an LinkedAlgorithms containing the strings in the same order that * they appear in the linked list, but the second, third, etc copy is * not put into the array list. Some examples: (A, D, D, A, B, B, C, D, A] should return the list D, B, C1 (A, B, C) (A, A, B] [B, A, A, B] should return the set [A,B,C] should return the set [A, B] should return the set [B, A] @return ArrayList of unique strings public ArrayList getUniques() { return null; } /** * Returns a copy of the linked list but with only words # with length minLength or longer are inserted. Some examples: [hello, world, hi, bye, I, me, hi] with minLength=2 should return: [hello, world, hi, bye, me, hil [hello,world, hi, bye, I, me, hi] with minlength=3 should return: [hello,world] * * @return The list of words with short ones removed. public StringLinkedList removeShorts(int minLength) { return null; } /* * Determines if the two list contains values that contain exactly the same + value, with the same counts, but in perhaps different order. @returns true only if the two lists are permutations of one another. public boolean anagrams (StringLinkedList other) { return false; public static void main(String[] args) { String() items = { "hello", "world" ); StringLinkedList LL1 = new StringLinkedlist(); StringLinkedList LL2 = new StringLinkedlist (items); StringLinkedList LL3 = new StringLinkedList (LLL); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!