Hello, I am trying to add String objects into a linked list alphabetically. However, when I put multiple strings in and go to print it it will only print the first thing I input; losing the rest of the Strings.
My problem I think is adding a New Node(Store) at the beginning and then keeping track of the next Node when added is still pointing to null or just not adding it at all
public static void addStore(Store newStore, String location) { Store current = head; if(head == null) { Store newNode = new Store(location); head = newNode; } else while(current.getNext() != null && newStore.getStoreLocation().compareTo(current.getStoreLocation()) == -1) { current = current.getNext(); } newStore.setNextStore(current); }