jakartaee / jakartaee/mail-api
Use map instead of array for headers variable in InternetHeaders
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 285
- Forks
- 109
- Avg merge
- 15h 19m
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
Referring to this variable, https://github.com/eclipse-ee4j/mail/blob/master/mail/src/main/java/jakarta/mail/internet/InternetHeaders.java#L277, I believe there is merit in making the headers variable a Map. Key would be header name and value would be a list of Strings (to account for same header occuring multiple times). This makes header lookups via getHeader() method more performant by avoiding having to loop through the list everytime (https://github.com/eclipse-ee4j/mail/blob/master/mail/src/main/java/jakarta/mail/internet/InternetHeaders.java#L465)
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
Use map instead of list.
**Describe alternatives you've considered**
**Additional context**
If you are comfortable with it, I can implement and raise a pull request for the same.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in mail/src/main/java/jakarta/mail/internet/InternetHeaders.java around the headers declaration near line 277 and the getHeader() implementation near line 465. Trace all accesses to the headers variable and verify that repeated header names remain supported; the work is done when lookups use the new map representation without changing observable header behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100