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.Answer:
You can implement it easily with a lambda function.If you have better answer, please add a comment about this, thank you!