-5

我想迭代accountset List<AccountTO>和设置的值AccountID

实际上,accountset我正在获取值:100,101,102我想将值添加到List<AccounTO>并设置它们AccountID并将其传递给服务调用。有什么我可以去的或任何其他程序。

for(String s :group.getAccounts().keySet())
{
    System.out.println("===="+s.lastIndexOf("-"));
    System.out.println("sub"+s.substring(0,s.lastIndexOf("-")));
    accountSet.add(s.substring(0, s.lastIndexOf("-")));
}
4

1 回答 1

1

如果我正确理解了这个问题,它应该相当简单:

List<AssetAllocationTO> someList = new ArrayList<AssetAllocationTO>();

for (String string : group.getAccounts().keySet()){
            AssetAllocationTO al = new AssetAllocationTO();
            al.setAccountID(string);
            someList.add(al);
}
于 2012-05-08T22:11:25.457 回答