我有一个ArrayList<UIToto>
,每个都UIToto
包含
(String id, String name, String info)
例如
(4546-fdsf4545sfd-dfs545, titi, female)
(dqs4d65q4-45d4s54545sfd-dfss54545, tutu, male)
我有一个 ID 列表,例如
String ids = "dqs4d65q4-45d4s54545sfd-dfss54545, 4545-dsqd45-dqs,4d5s44-ss4-dqsd";
对于每个 id,我检索 id 并希望在我的 ArrayList 中获取 UIToto:
ArrayList<UIToto> totoList = retrieveTotoList();
String[] ids = "dqs4d65q4-45d4s54545sfd-dfss54545, 4545-dsqd45-dqs,4d5s44-ss4-dqsd";
for(int i=0; i <= ids.length; i++) {
System.out.println(("id = " + ids[i]);
//don't work because it's not the index but the id ...
UIToto response = totoList.get(Integer.parseInt(ids[1]));
System.out.println("response = " + response);
}
是否可以?
谢谢!