Link to home
Start Free TrialLog in
Avatar of ajackson99
ajackson99

asked on

Colloection choice, which one is best for my problem

I have been studing the collection material I could find on the webulator, My problem is as follows;

1, Class a (customers) containd a Cust_ID String and a customer name.
2, Class b (SalesOrder) contains details of sales orders including Cust_ID which has a one to many relationship with class a

I would like to create a data structure which contains both sets of data with class a as the key and class b as the
value(s).

I would like to be able to retrieve multiple instances of class b dependant on a value of class a.  I also want that class b is retrieved in a particular sequence (Document number)

I have looked at MAPs   but they want unique values.

I do not want anyone to write the code ,just a nudge in the right direction, I'm thinking TreeSets. Examples of code pertaining to nudging however will not be frowned upon.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You need

Map<ClassA, List<ClassB>>;
> I also want that class b is retrieved in a particular sequence (Document number)
Use TreeSet or PriorityQueue for bs
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial