ストリーム ストリーム、エンティティ オブジェクト コレクションをマップ データ型に変換: (id: エンティティ クラス)

Stream を使用してエンティティ クラスをマップ データ型に収集します: (id: エンティティ クラス) コードは次のとおりです。

 Map<String, Units> orderAdvancePaymentDetailMap = units.stream()
          .collect(Collectors.toMap(Units::getName, Function.identity()));

おすすめ

転載: blog.csdn.net/m0_63364103/article/details/130226900