zoukankan      html  css  js  c++  java
  • 价格区间方法

    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;

    }
  • 相关阅读:
    LR三:post接口_ajax上传
    LR二:post接口_form表单上传
    Dijkstra优先队列优化
    Misha and Changing Handles
    HDU-1428(记忆化搜索)
    CF-599B
    POJ-1488(字符串应用)
    New Year Permutation(Floyd+并查集)
    HDU-1078
    HDU-5532(LIS-nlogn)
  • 原文地址:https://www.cnblogs.com/LQ970811/p/12692501.html
Copyright © 2011-2022 走看看