Danii 0 Newbie Poster

define a method addOn that it adds the data argument to the list in the sorted location in alphabetical. There can only be one of each company in this list.

public void addOn(company data)
    {
        Node it = new Node(data, head);

        head = it;

        it.data.toString();

    }   

this is a small method inside of my homework.
when I ran this it simply add nodes to the head NOT to the "sorted list"

I think there are 4 cases :
1) 0 nodes
2) 1 nodes
3) 3 nodes
4) more than 3 nodes

Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.