【发布时间】:2016-01-24 13:34:57
【问题描述】:
我想得到:
String[] phoneNos= {"07064267499","07064267499","07064267499"};
来自:
ArrayList<Object> phoneNos = [0803406914, 08167337499, 0803377973] ;
这是我的代码 sn-p :
public ArrayList < Object > getPhoneNo() {
ArrayList < Object > phoneNos = new ArrayList < Object > ();
try {
Statement stmt = con.createStatement();
ResultSet result = stmt.executeQuery("SELECT Phone_No FROM paient_details");
while (result.next()) {
phoneNos.add(result.getString(1));
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return phoneNos;
}
【问题讨论】:
-
也许你可以看一下 Guava 的转换列表,如下所述:stackoverflow.com/questions/7383624/…