Everywhere I look, I see the typing of Collections done like this:
Set<String> set = new HashSet<String>();
However, I define my Collections like this
Set<String> set = new HashSet();
and I still get the type checking (and my way is just cleaner to look at).
Maybe this has something to do when creating generic collections? But, let's say I just want nothing more than a HashSet of Strings, then is not
Set<String> set = new HashSet();
enough?
var set = new HashSet<String>();
Though this will have a bunch of dangers that are discussed elsewhere.var
is syntactic sugar. I've actually posted a question and answer about it here: stackoverflow.com/questions/49744891/…