2017-04-21から1日間の記事一覧

Collectors.toMap() は第3引数を意識してください

リストからマップを作る時に使う以下のコード Map<String, String> phoneBook = people.stream() .collect(Collectors.toMap(Person::getName, Person::getAddress); なつかしい以下のコードとは挙動が異なります。 Map<String, String> phoneBook = new HashMap<>(); for (Person p : people</string,></string,>…