I'm trying to make something like this.
Let's say my EnumMap looks like this EnumMap<Animals, Set<Integer>>.
I have keys like: Dog,Fish,Cat from Animals class. And I want to print all values from Animals Dog, Fish and Cat.
- Dog has values: - 1,2,3
- Fish has values - 4,5,6
- Cat has values: - 2,5,7
As you can see, Cat has 2 from Dog, and 5 from Fish. So the output will be: 1,2,3,4,5,6,2,5,7.
I want to remove duplicates during adding process to EnumMap.
So it should be like: 1,2,3,4,5,6,7. I cannot filter later after adding all values. How can I do this?
This should help:
Output:
This is not very optimized and clean, but should give you an idea on how to proceed.