I believe this is a set of integer hashsets, but I'm confused about why []
are used before and after the equals sign.
Asked
Active
Viewed 25 times
0

halfer
- 19,824
- 17
- 99
- 186

Katie Melosto
- 1,047
- 2
- 14
- 35
1 Answers
1
It is an array of sets, which means there are multiple sets of type Integer
. In the given example you have 4 different sets combined in a single array. For accessing the first two sets you can write:
Set<Integer> setW = sets[0];
// Here you can work with setW
Set<Integer> setX = sets[1];
// Here you can work with setX
...
or you can use a loop for iterating the array and accessing all sets:
for (Set<Integer> set : sets) {
set.forEach(System.out::println);
}

wake-0
- 3,918
- 5
- 28
- 45