Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AddressMapper.kt #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GeorgCantor
Copy link

Use of flatMap:
The flatMap function is used to transform each AddressComponent into pairs of type and the component itself. This flattens the structure into a single list of pairs, making it easier to group by type.

Use of groupBy:
The groupBy function is then applied to this list of pairs. It takes a selector for the key (the type) and a selector for the value (the AddressComponent). This eliminates the need for manual initialization and population of the map.

Immutable Map:
The result is an immutable Map<String, List>, which is generally preferred in Kotlin for better safety and clarity.


Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@dkhawk
Copy link
Collaborator

dkhawk commented Oct 7, 2024

Thanks for opening this PR! Before we merge it, could you please take a look at the commit messages? We're using Conventional Commits to help keep our commit history organized, and it looks like this doesn't follow that format. Also, please update the PR title to have a conventional commit prefix.

Thanks again and let me know if you have any questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants