[java]代码库
方法1
HashMap<String ,String> questionMap = new HashMap<String , String>();
for(int i=0;i<listMyQuestionDisplay.size();i++){
for(int j=0;j<listData.size();j++){
if(listMyQuestionDisplay.get(i).getId()==listData.get(j).getQuestionType().getId()){
questionMap.put(listMyQuestionDisplay.get(i).getId(), listMyQuestionDisplay.get(i).getQuestionTypeName());
}
}
}
listMyQuestionDisplay.clear();
for (String key : questionMap.keySet()) {
DisplaceQuestionTypeEntity myQuestionDisplay = new DisplaceQuestionTypeEntity();
myQuestionDisplay.id=key;
myQuestionDisplay.questionTypeName=questionMap.get(key);
listMyQuestionDisplay.add(myQuestionDisplay);
}
方法2
for(int i=0;i<ii.size()-1;i++){
for(int j=i+1;j<ii.size();j++){
if(ii.get(i).id==ii.get(j).getId()&&ii.get(i).publicid==ii.get(j).publicid){
score=ii.get(j).getScore()+ bookList.get(i).getScore();
bookList.get(i).setScore(score);;
bookList.remove(j);
j=j-1;
}
}
}