list转map的方法,通过Java8的stream流

    技术2022-07-12  86

    public Map<Long, Account> getIdAccountMap(List<Account> accounts) { return accounts.stream().collect(Collectors.toMap(Account::getId, account -> account)); }
    Processed: 0.011, SQL: 9