jakartaee / jakartaee/mail-api

Use map instead of array for headers variable in InternetHeaders

Open
#551 6 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.