Java(jdk1.8 above)中list.stream()的使用

  1. 如何将对象list转为以某列为key,对象为value的map:

    List<list> list = Lists.partition(this.trustContractList, Constant.ONE_THOUSAND);

    for(List li:list){

    Map contractMap = li.stream().collect(Collectors.toMap(TrustContractEx -> TrustContractEx.getProdContractNo(), TrustContractEx -> TrustContractEx));

}