[Solved] How to make ArrayList of hashset in java? [closed]


Just make an ArrayList of HashSets :

ArrayList<HashSet<Integer>> list = new ArrayList<HashSet<Integer>>();

Then create HashSets, fill them, and put them in your ArrayList normally.

HashSet<Integer> set = new HashSet<Integer>();
set.add(1);
set.add(whateverIntValue);
list.add(set);

You can then get the nth HashSet of your list using list.get(n).

solved How to make ArrayList of hashset in java? [closed]