private String getMainTitle(List<String> bs){
for(String b:bs){
if (b.equals("GOOD"){
return "string";
}
}
return null;
}
private String getMainTitle(String b){
if (b.equals("GOOD"){
return "string";
}
return null;
}
public String getTitleFromString(String b){
return getMainTitle(b);
}
public String getTitleFromList(List<String> bs){
return getMainTitle(bs);
}
請問怎样在JAVA寫一個含未知類的參數的方法?
希望寫一個方法能替代getTitleFromString和getTitleFromList , 比如:
public String getTitleFromList(T<?> t){
return getMainTitle(t);
}
但我的語法有誤, 請問該怎样改寫?
으아악
으아아아
이렇게 하면 됩니다
으아악으아악