我有一个非常简单的问题-
我有一个名为的类DEClient
,其构造函数是这样的-
public DEClient(List<DEKey> keys) {
process(keys);
}
DEKey
上课是这样的——
public class DEKey {
private String name;
private String value;
public DEKey(){
name = null;
value = null;
}
public DEKey(String name, String value){
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
现在我正在尝试实例化DEClient
构造函数。所以为此我需要拥有List<DEKey>
.
所以我所做的是我使用(将返回)和作为值来实例化如下所示的DEKey
类。service.getKeys()
String
id
DEKey dk = new DEKey(service.getKeys(), id);
//The below line throws exception whenever I am running.
DEClient deClient = new DEClient((List<DEKey>) dk);
我在这里做错了什么?