构造函数中带有泛型的Java类型错误

构造函数中带有泛型的Java类型错误,java,generics,constructor,undefined,Java,Generics,Constructor,Undefined,关于Java中的genrics,我有一个(可能很简单)问题。我有以下课程: public class ValueCollection<Y> implements Collection<Y> { private Set<Entry<?, Y>> entries; public ValueCollection(Set<Entry<?, Y>> entries) { this.entrie

关于Java中的genrics,我有一个(可能很简单)问题。我有以下课程:

public class ValueCollection<Y> implements Collection<Y>
{
    private Set<Entry<?, Y>> entries;

    public ValueCollection(Set<Entry<?, Y>> entries)
    {
        this.entries = entries;
    }
    ...
}
public类ValueCollection实现集合
{

private SetA
Set如果在第一种情况下使用
new ValueCollection(entries)
调用构造函数会怎么样?您的第一个类只有一个类型参数。非常感谢!这正是我想知道的。您的解释很有意义。
return new ValueCollection<V>(entries);
The constructor ValueCollection<V>(Set<Map.Entry<K,V>>) is undefined
public class ValueCollection<X, Y> implements Collection<Y>
{
    private Set<Entry<X, Y>> entries;

    public ValueCollection(Set<Entry<X, Y>> entries)
    {
        this.entries = entries;
    }
    ...
}
return new ValueCollection<K, V>(this.entries());