Hi all,
say I have a list of Cars with the following properties:
long agencyId;
long carId;
String type;
There are 10,000 items in my arrayList named carList. and there are ~ 50 agencies (ids). I would like to create X new array list such that every list will contain only cars from the same agencyId. example, the list of carList_A will contain cars object from agencyId=14593.
Every time I tackle this type of problems, I managed to solve it but with so many 'if statements', 'exceptions scenarios' and pointers that points to the id and figures if its a new id or not.
I wonder if there's such design
pattern to address this problem or just a simple way to do that.
thanks for any thoughts