我想迭代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("-")));
}
答案 0 :(得分:1)
如果我正确理解了这个问题,那应该很简单:
List<AssetAllocationTO> someList = new ArrayList<AssetAllocationTO>();
for (String string : group.getAccounts().keySet()){
AssetAllocationTO al = new AssetAllocationTO();
al.setAccountID(string);
someList.add(al);
}