How to instantiate a collection in Java using Generics?

How to instantiate a collection in Java using Generics?



Set<String> myStringSet = new HashSet();

Set<String> myStringSet = new HashSet<String>();

Set<String> myStringSet = new HashSet<String>();

Set<String> myStringSet = new HashSet<String>();

Type safety: The expression of type HashSet needs unchecked conversion
to conform to Set <String>.

Comments

Popular posts from this blog

How to change this to <%Html.ActionLink%> in my asp.net mvc application ?