Dear Java Programmer:
public class FindDups {
public static void main(String[] args) {
Set<String> s = new HashSet<String>();
for (String a : args)
if (!s.add(a))
System.out.println("Duplicate detected: " + a);
System.out.println(s.size() + " distinct words: " + s);
Why is the newly created HashSet of String elements set as implicitly cast to a
string of Set. Why not write the following:
HashSet<String> s = new HashSet<String>();
?
?
?
Respects,
JKid314159
http://existentialists.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---