1、List對象拆分spa
//3. 根據產品拆分訂單 Map<String, List<Order>> orderMap = orderListAll.stream().collect(Collectors.groupingBy(Order::getProdProductId));
2、按條件篩選Listcode
List list = list.stream().filter(l -> l.getName().equals("x")).collect(Collectors.toList());
3、將對象某個屬性轉Listorm
List<String> idList = logisticsFinanceDayOrderList.stream().map(LogisticsFinanceDayOrder::getId).collect(Collectors.toList());
2、其它對象
exportExcelTemplateItems.stream().forEach(exportExcelTemplateItem -> { System.out.println(exportExcelTemplateItem); }); 獲取當前訂單全部箱子的總個數 Integer count = customerGoodsMessageVOList.stream().mapToInt(CustomerGoodsMessageVO::getCount).sum(); List listComplete = listBoxDtos.stream().filter(boxDtos -> null != boxDtos.getOperationComplete()).collect(Collectors.toList()).stream().filter(boxDtos -> true == boxDtos.getOperationComplete()).collect(Collectors.toList()); Map<String, String> map = platformIncomeWithdrawFianceHistoryDao.getDistinctAccountType().stream().collect(Collectors.toMap(String::toString, s -> s)); dataGrid.getRows().stream().skip((pageNo - 1) * pageSize).limit(pageSize).forEach(e -> currentPageData.add(e)); //獲取產品的前n條 List<CustomerProductSearchResponseVO> filterProducts = Lists.newArrayList(); productDataGrid.getRows().stream().limit(singleQueryShowProductCount).forEach(row -> filterProducts.add(row));
totalWeight = financeOrderList.stream().map(CustomerFinanceOrder::getWeight).reduce(Float::sum).get();
if (!clearGoodsList.stream().anyMatch(clearGoods -> clearGoods.getDescription().equals(clearOrderRequestVO.getGoodsName()))) {
iterator.remove();
}
Float totalWeight1 = financeOrderList.stream().map(CustomerFinanceOrder::getWeight).reduce((Float::sum)).get();
BigDecimal totalBeforeDiscountPrice1 = financeOrderList.stream().map(CustomerFinanceOrder::getBeforeDiscountPrice).reduce(BigDecimal::add).get();
List passIdList = entrySet.entrySet().stream().filter(s -> Long.valueOf(String.valueOf(s.getValue())) >= 200).map(Map.Entry::getKey).collect(Collectors.toList());
Boolean isHas = roles.stream().anyMatch((role) -> User.UserRoleCode.sale.name().equals(role.getCode()));
[{"0":"a","1":"b"},{"0":"a1","1":"b1"}] -> {a:b,a1:b2}blog