The implementation of templates in Java?

Have done so:
public class Trie<t> implements Map<string, t> {
 private class TrieEntry<s> implements Map.Entry<string, s> {
 // stupid implementation here
 // uninterested code here

Everything is OK.

But the description of the method entrySet():
public Set<<string, t>> entrySet() {
 Set<<string, t>> x = new HashSet<trieentry<t>>();
 // some uninterested code here

Eclipse does:

"Type mismatch: cannot convert from HashSet to Set>"

Where am I wrong?
October 8th 19 at 00:37
2 answers
October 8th 19 at 00:39
If A extends B, this does not mean that the Set extends Setyou Can just write
Set> x = new HashSet>();
and to put its implementation.
October 8th 19 at 00:41
Try this
Set> x = new HashSet();
Didn't notice the link to stackoverflow, where in principle the answer has already been - roslyn commented on October 8th 19 at 00:44

Find more questions by tags Java