개발
자바 리스트 버블정렬
철산92
2020. 2. 12. 17:32
반응형
for(int i=0;i<sample.size()-1;i++){
for(int j=i+1;j<sample.size();j++){
HashMap<String, String> tempMap1 = sampleMap.get(i);
HashMap<String, String> tempMap2 = sampleMap.get(j);
int a = Integer.parseInt(tempMap1.get("st"));
int b = Integer.parseInt(tempMap2.get("st"));
if(a>b){
Collections.swap(sample,i,j);
}
}
}
반응형