Java 类型参数FooEntity正在隐藏类型FooEntity 公共接口IFoo{ //东西 }

Java 类型参数FooEntity正在隐藏类型FooEntity 公共接口IFoo{ //东西 },java,generics,Java,Generics,我得到这个错误: 类型参数footentity正在隐藏类型footentity public interface IFoo<TKey, FooEntity<TValue>> { // stuff } 公共类实体{ 私人T foo ;; } 我怎样才能解决这个问题 我希望能够在其他地方实现IFoo接口。试试看 public class FooEntity<T> { private T foo; } 类实体{} 接口IFoo{} 类ifoo

我得到这个错误:
类型参数footentity正在隐藏类型footentity

public interface IFoo<TKey, FooEntity<TValue>> {
  // stuff
}
公共类实体{
私人T foo ;;
}
我怎样才能解决这个问题

我希望能够在其他地方实现IFoo接口。

试试看

public class FooEntity<T> {

    private T foo;


}
类实体{}
接口IFoo{}
类ifooImpleSleere实现IFoo{}
IFoo ifi=新的IFOOImpleSweere();
试试看

public class FooEntity<T> {

    private T foo;


}
类实体{}
接口IFoo{}
类ifooImpleSleere实现IFoo{}
IFoo ifi=新的IFOOImpleSweere();
请参见:

class FooEntity<K> {  } 

interface IFoo<K,V> {  } 

class IFooImplElseWere<K,V> implements IFoo<K,V> {  }

IFoo<String, FooEntity<String>> ifi = new IFooImplElseWere<String,FooEntity<String>>();

公共类MyFoo实现IFoo{
@凌驾
公共void doSomething(字符串键、实体值){
//托多:。。。。
}
}
请参见:

class FooEntity<K> {  } 

interface IFoo<K,V> {  } 

class IFooImplElseWere<K,V> implements IFoo<K,V> {  }

IFoo<String, FooEntity<String>> ifi = new IFooImplElseWere<String,FooEntity<String>>();

公共类MyFoo实现IFoo{
@凌驾
公共void doSomething(字符串键、实体值){
//托多:。。。。
}
}
public class MyFoo implements IFoo<String, Integer> {
    @Override
    public void doSomething(String key, FooEntity<Integer> value) {
        // TODO: ....
    }
}