How to write this without
HashSet<String> Cats = map.getAll();
int numCats = Cats.size()
I have tried in so many different ways, but I always get an unchecked exception. getAll generates a HashSet.
Code :
int numCats = map.getAll.size();
HashSet<String> Cats = new HashSet <String>();
Cats = map.getAll(); or Cats.add(map.getAll());
etc
no matter what I do I get unchecked
Re: How to write this without
I don't understand the question. If you are asking how to do it without the Generics then I counter with: Why do you want to do that?
If you get the "unchecked exception" then it is only a warning. your code will still compile and run. Or you can compile with the "suppress warnings" option.
Re: How to write this without
If you want help with code, you'll have to post an SSCCE demonstrating what you're actually doing. Otherwise we're just guessing.