冒泡算法

public void mpPhone(List<PhoneBean> phoneBean){
	int length = phoneBean.size();
	for(int i = 0;i < length-1;i++){
		for(int j = length-1;j > i;j--){
			int d = phoneBean.get(j).getPriority();
			int d1 = phoneBean.get(j-1).getPriority();
				if(d > d1){
					PhoneBean temp = phoneBean.get(j);
					phoneBean.set(j, phoneBean.get(j-1));
					phoneBean.set(j-1, temp);
				}
			}
		}
	}

你可能感兴趣的:(算法)