public class MyAgreementList {
private String name;
private List<MyAgreement> agreementList;
public List<MyAgreement> getAgreementList() {
return agreementList;
}
public void setAgreementList(List<MyAgreement> agreementList) {
this.agreementList = agreementList;
}
}
我想将MyAgreementList转换为Map,任何人都可以帮助我吗? 我想要的结果是:Map有两个键:name,agreementList,List值不能丢失
有没有任何框架可以支持这个?
答案 0 :(得分:0)
psudocode:迭代列表并获取协议ID并添加为键,否则为key维护一些计数器。希望这有帮助
for(MyAgreement mya : agreementList){
map.put(mya.getId(),mya);
//maintain a counter say counter
//map.put(counter++,mya);
}