1.分组
private List<SaleGroupByStoreBO> groupByStoreBOList(BusinessSalesRequest request) { List<BusinessSalesVO> saleTypeAndStoreList = businessSalesMapper.getSaleTypeAndStore(request); if (CollectionUtils.isEmpty(saleTypeAndStoreList)) { return null; } List<SaleGroupByStoreBO> saleGroupByTypeBOList = new ArrayList<>(); Map<String, List<BusinessSalesVO>> collect = saleTypeAndStoreList.stream().collect(groupingBy(BusinessSalesVO::getStoreId)); for (Map.Entry<String, List<BusinessSalesVO>> listEntry : collect.entrySet()) { SaleGroupByStoreBO saleGroupByTypeBO = new SaleGroupByStoreBO(); saleGroupByTypeBO.setStoreId(listEntry.getKey()); saleGroupByTypeBO.setSaleVOList(listEntry.getValue()); saleGroupByTypeBOList.add(saleGroupByTypeBO); } return saleGroupByTypeBOList; }
2.排序(降序)
List<SaleDetailTypeAndStoreBO> collect = boList.stream().sorted(Comparator.comparing(SaleDetailTypeAndStoreBO::getCollectStoreSale).reversed()).collect(Collectors.toList());
3.判断集合中是否存在某个值
for (String storeId : storeList) {
Optional<BusinessSalesAllStoreBO> any = allStoreSales.stream().filter(a -> a.getStoreId().equals(storeId)).findAny();
if (!any.isPresent()) {
stringList.add(getBusinessStoreName(storeId));
//想要获取值时
//String storeName=any.get().getStoreName();
}
}
4.端口占用
例如:
netstat -aon|findstr "8028"
taskkill /pid 11308