質問

I'm creating a program which stores the jobs done for a client inside a LinkedList and the LinkedList represents a client. How can I achieve that my LinkedLists are added to a binary tree as the nodes so I can easily search for clients and then look at their jobs?

So far I have coded a linkedList and the job class, but I haven't made the binary tree yet

役に立ちましたか?

解決

Before all you should consider using classes. This will make your code more manageable and readable. For starters let me suggest:

class Client extends LinkedList<Job> {...}

You can change this later on as it fits your needs.

Now simple use a TreeMap to store them:

TreeMap<String,Client> clients = new TreeMap<>();
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top