Map<String, Map<String, List<AmazonBalanceCustom>>> amazonBalanceMap = amazonBalances.stream() .filter(item -> StringUtils.isNotBlank(item.getDeptName()) && item.getUsdBalance() != null) .collect(Collectors.groupingBy(AmazonBalanceCustom::getDeptName, Collectors .groupingBy(item -> StringUtils.isNotBlank(item.getSupervisorName()) ? item .getSupervisorName() : "")));