Arraylist elements in Treeset
Hi!
At the moment I am doing a course for Java Enterprise programmer and I have an asignment I got stuck on.
I have to create something like a shopping basket. For this I have to put elements from an Arraylist (catalogue with articles) in a Treeset (currently selected articles from the catalogue).
To be more precise, I have to key in an article number and the program than has to find the related article from the Arraylist and put that in the shopping basket (Treeset).
Most else is going ok, just this problem, if I can do this I can do the rest of the assignment.
Hopefully somebody can help me with an example of a similair piece of code.
Thanx in advance!
Greets
Tony
Re: Arraylist elements in Treeset
Quote:
find the related article from the Arraylist and put that in the shopping basket (Treeset).
That sounds like you need a loop to search the arraylist for the element with the key
Re: Arraylist elements in Treeset
Thanks! I'll give it a go, but I think it's something wrong with my declaration of the Treeset - private Set<List<Producten>> winkelTs = new TreeSet<List<Producten>>();
This is a very hard subject I think.
Re: Arraylist elements in Treeset
If you are getting errors, please copy the full text of the error messages and paste it here.