I was wondering if it's actually possible to read in a text file of the following,

Code:
Item1,Brand1
Item2,Brand1
Item3,Brand2
Item4,Brand2
Then dynamically create individual array lists according to the different brand names (ignoring duplicates), instead of manually counting how many different brands there are and manually creating.

For example, if there are three different brands found, there would be three individual array lists. If I append the text file and have four brands, there would be four array lists automatically created. So on and so for.

I was planning on putting the array lists into a single hashmap<String, ArrayList>, called Brands (with the brand name as key), where I can simply extract keys and values out to do object comparison for something like a search filter/result according to the different brands.

Is it possible? What other ways can I do and what exactly should I look into?


Thanks in advanced,
Daniel