小编ank*_*r43的帖子

To accept a String in an ArrayList in java as ReturnType

I have a variable in class XYZ named abc. The return type of that variable is List but earlier its return type was String.So, now when a list comes as a input it is processed but when a String comes it throws Exception. the need is to make it compatible for both datatypes List as well as String. Please help

private List<String> abc;

public List<String> getAbc() {
    return abc;
}

public void setAbc(List<String> abc) {
    this.abc = abc;
}
Run Code Online (Sandbox Code Playgroud)

java string arraylist

5
推荐指数
2
解决办法
104
查看次数

标签 统计

arraylist ×1

java ×1

string ×1