• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Map example in java

Resolved: Map example in java

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I would like to write lastnamesByFirstname method. In the people lists, there are bunch of people, and each person have two field the firstname and the second name. I would like to write a method which will turn back in the following way, key value would be the firstname, and the value list would be those name which firstnames are the same. I tried with groupingby wiht sorting buts somehow never worked.
my attempt look like this, but the type would be not matching with the return type.

Answer:

You can implement it easily with a lambda function.

If you have better answer, please add a comment about this, thank you!

java
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘crm.email’ doesn’t exist (Connection: mysql, SQL: select count(*) as aggregate from `email`

02/04/2023

Resolved: Regex: Curly braces in reverse? Match X characters before a string?

02/04/2023

Resolved: build.gradle.kts task to return string

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.