价格区间方法

List<Integer> integers = new ArrayList<Integer>();
integers.add(13);
integers.add(113);
integers.add(14);
integers.add(56);
//最大值 最小值
System.out.println("min:"+Collections.min(integers));
System.out.println("max:"+Collections.max(integers));

 

  //商品规格转换
public GoodsSpecsResonse covSpec(List<ZxGoodsSpecs> specsList)
{
Integer totalNum=0;
String priceBetween = "";
List<String> integerList = new ArrayList<>();
GoodsSpecsResonse resonse=new GoodsSpecsResonse();
for (ZxGoodsSpecs specs: specsList){
//库存总量
totalNum=totalNum+specs.getNum();

integerList.add(specs.getPrice());
resonse.setSmallImg(specs.getSmallImg());
}
resonse.setTotalNum(totalNum);
//价格区间
priceBetween = Collections.min(integerList) +" - " +Collections.max(integerList);
if(Collections.min(integerList).equals(Collections.max(integerList))){
priceBetween = Collections.min(integerList) ;
}

resonse.setPriceBetween(priceBetween);
return resonse;

}
posted @ 2020-04-13 17:06  葵儿啊  阅读(552)  评论(0编辑  收藏  举报
/*粒子线条,鼠标移动会以鼠标为中心吸附的特效*/