public Boolean insertBefore(String newItem, String itemToInsertBefore)
Without using the java collections interface (i.e. do not import java.util.List, LinkedList, etc. )
Write a java program that inserts a new String element (String newItem) into a linked list before another specified item (String itemToInsertBefore).
For example if items "A", "B", "C" and "D" are in a linked list in that order and the below method is called, insertBefore("E", "C"), then "E" would be inserted before "C", making the final list to be "A", "B", "E", "C" and "D" with no nulls or blank elements or any elements missing or anything. It should work for all lenghths of linkedlists of Strings.
public Boolean insertBefore(String newItem, String itemToInsertBefore)
{
// returns true if done successfully, else returns false if itemToInsertBefore cannot be found or some other error
}

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









