Hi. Set is interface, HashSet is class that implements Set interface, so both ways are correct. The recommended way depends on your task :)
Kind regards, Roman. 2012/1/5 Friedrich Clausen <[email protected]> > Hello, > > In section 1.2, in exercise program Set-HashSet-FindDup we declare a > new HashSet like so - > > Set s = new HashSet(); > > but I notice that > > HashSet s = new HashSet(); > > also works. What is the recommended way to create a new HashSet > instance? > > Thanks! > > Fred. > > -- > You received this message because you are subscribed to the Google Groups > "JPassion.com: Java Programming" group. > 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/jpassion_java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "JPassion.com: Java Programming" group. 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/jpassion_java?hl=en.
